0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-10 00:40:30 -05:00
penpot/backend/resources/migrations/0012-make-libraries-linked-to-a-file.sql
2020-08-05 12:50:33 +02:00

21 lines
531 B
SQL

TRUNCATE TABLE color;
TRUNCATE TABLE color_library CASCADE;
TRUNCATE TABLE image;
TRUNCATE TABLE image_library CASCADE;
TRUNCATE TABLE icon;
TRUNCATE TABLE icon_library CASCADE;
ALTER TABLE color
DROP COLUMN library_id,
ADD COLUMN file_id uuid NOT NULL REFERENCES file(id) ON DELETE CASCADE;
CREATE INDEX color__file_id__idx
ON color(file_id);
ALTER TABLE image
DROP COLUMN library_id,
ADD COLUMN file_id uuid NOT NULL REFERENCES file(id) ON DELETE CASCADE;
CREATE INDEX image__file_id__idx
ON image(file_id);