Initial commit
This commit is contained in:
16
packages/db/migrations/0002_assets_duration_and_indexes.sql
Normal file
16
packages/db/migrations/0002_assets_duration_and_indexes.sql
Normal file
@@ -0,0 +1,16 @@
|
||||
-- Task 2 follow-up: align schema with PLAN.md
|
||||
|
||||
-- 1) duration_seconds should be int (seconds)
|
||||
ALTER TABLE assets
|
||||
ALTER COLUMN duration_seconds
|
||||
TYPE int
|
||||
USING (
|
||||
CASE
|
||||
WHEN duration_seconds IS NULL THEN NULL
|
||||
ELSE round(duration_seconds)::int
|
||||
END
|
||||
);
|
||||
|
||||
-- 2) source_key uniqueness should be per-bucket
|
||||
DROP INDEX IF EXISTS assets_source_key_idx;
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS assets_bucket_source_key_uidx ON assets (bucket, source_key);
|
||||
Reference in New Issue
Block a user