init push
This commit is contained in:
21
migrations/20260630_add_is_template_to_file_files.sql
Normal file
21
migrations/20260630_add_is_template_to_file_files.sql
Normal file
@@ -0,0 +1,21 @@
|
||||
-- +goose Up
|
||||
ALTER TABLE file_files
|
||||
ADD COLUMN is_template TINYINT(1) NOT NULL DEFAULT 0 AFTER checksum_sha256;
|
||||
|
||||
UPDATE file_files
|
||||
SET is_template = 1
|
||||
WHERE EXISTS (
|
||||
SELECT 1
|
||||
FROM helicopter_files hf
|
||||
WHERE hf.source_file_id = file_files.id
|
||||
)
|
||||
OR EXISTS (
|
||||
SELECT 1
|
||||
FROM helicopter_files hf
|
||||
INNER JOIN attachments a ON a.id = hf.file_attachment_id
|
||||
AND a.file_id = file_files.id
|
||||
);
|
||||
|
||||
-- +goose Down
|
||||
ALTER TABLE file_files
|
||||
DROP COLUMN is_template;
|
||||
Reference in New Issue
Block a user