Files
quyun-v2/backend/database/migrations/20251231185500_add_hash_to_media_assets.sql
Rogee 221b068a84 feat: add file deduplication and hash checking for uploads
- Implemented SHA-256 hashing for uploaded files to enable deduplication.
- Added CheckHash method to verify if a file with the same hash already exists.
- Updated Upload method to reuse existing media assets if a duplicate is found.
- Introduced a new hash column in the media_assets table to store file hashes.
- Enhanced the upload process to include progress tracking and hash calculation.
- Modified frontend to check for existing files before uploading and to show upload progress.
- Added vuedraggable for drag-and-drop functionality in the content editing view.
2025-12-31 19:16:02 +08:00

8 lines
289 B
SQL

-- +goose Up
ALTER TABLE media_assets ADD COLUMN hash VARCHAR(64) DEFAULT '';
CREATE INDEX idx_media_assets_hash ON media_assets (hash);
COMMENT ON COLUMN media_assets.hash IS 'File SHA-256 hash';
-- +goose Down
DROP INDEX idx_media_assets_hash;
ALTER TABLE media_assets DROP COLUMN hash;