0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-24 15:39:50 -05:00
penpot/backend/resources/migrations/0017-link-files-to-libraries.sql
2020-08-17 09:35:25 +02:00

15 lines
466 B
SQL

CREATE TABLE file_library_rel (
file_id uuid NOT NULL REFERENCES file(id) ON DELETE CASCADE,
library_file_id uuid NOT NULL REFERENCES file(id) ON DELETE RESTRICT,
created_at timestamptz NOT NULL DEFAULT clock_timestamp(),
PRIMARY KEY (file_id, library_file_id)
);
COMMENT ON TABLE file_library_rel
IS 'Relation between files and the shared library files they use (NM)';
CREATE INDEX file_library_rel__file_id__idx
ON file_library_rel(file_id);