mirror of
https://github.com/simplex-chat/simplexmq.git
synced 2026-05-13 23:03:15 +00:00
refactor: merge file_size CHECK into initial migration
This commit is contained in:
@@ -14,8 +14,7 @@ import Text.RawString.QQ (r)
|
||||
|
||||
xftpSchemaMigrations :: [(String, Text, Maybe Text)]
|
||||
xftpSchemaMigrations =
|
||||
[ ("20260325_initial", m20260325_initial, Nothing),
|
||||
("20260402_file_size_check", m20260402_file_size_check, Just down_m20260402_file_size_check)
|
||||
[ ("20260325_initial", m20260325_initial, Nothing)
|
||||
]
|
||||
|
||||
-- | The list of migrations in ascending order by date
|
||||
@@ -29,7 +28,7 @@ m20260325_initial =
|
||||
[r|
|
||||
CREATE TABLE files (
|
||||
sender_id BYTEA NOT NULL PRIMARY KEY,
|
||||
file_size INT4 NOT NULL,
|
||||
file_size INT4 NOT NULL CHECK (file_size > 0),
|
||||
file_digest BYTEA NOT NULL,
|
||||
sender_key BYTEA NOT NULL,
|
||||
file_path TEXT,
|
||||
@@ -46,15 +45,3 @@ CREATE TABLE recipients (
|
||||
CREATE INDEX idx_recipients_sender_id ON recipients (sender_id);
|
||||
CREATE INDEX idx_files_created_at ON files (created_at);
|
||||
|]
|
||||
|
||||
m20260402_file_size_check :: Text
|
||||
m20260402_file_size_check =
|
||||
[r|
|
||||
ALTER TABLE files ADD CONSTRAINT check_file_size_positive CHECK (file_size > 0);
|
||||
|]
|
||||
|
||||
down_m20260402_file_size_check :: Text
|
||||
down_m20260402_file_size_check =
|
||||
[r|
|
||||
ALTER TABLE files DROP CONSTRAINT check_file_size_positive;
|
||||
|]
|
||||
|
||||
Reference in New Issue
Block a user