mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-11-11 13:57:42 +00:00
migrations
This commit is contained in:
1 parent
6ebfd08def
commit
7eec044982
2 files changed
+57
No files matched your search
@@ -0,0 +1,29 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE QuasiQuotes #-}
|
||||
|
||||
module Simplex.Chat.Store.Postgres.Migrations.M20260926_link_notices where
|
||||
|
||||
import Data.Text (Text)
|
||||
import Text.RawString.QQ (r)
|
||||
|
||||
m20260926_link_notices :: Text
|
||||
m20260926_link_notices =
|
||||
[r|
|
||||
CREATE TABLE link_notices(
|
||||
link_notice_id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
||||
link_hash BYTEA NOT NULL,
|
||||
expires_at TIMESTAMPTZ,
|
||||
reason TEXT,
|
||||
created_at TIMESTAMPTZ NOT NULL,
|
||||
updated_at TIMESTAMPTZ NOT NULL
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX idx_link_notices_link_hash ON link_notices(link_hash);
|
||||
|]
|
||||
|
||||
down_m20260926_link_notices :: Text
|
||||
down_m20260926_link_notices =
|
||||
[r|
|
||||
DROP INDEX idx_link_notices_link_hash;
|
||||
DROP TABLE link_notices;
|
||||
|]
|
||||
@@ -0,0 +1,28 @@
|
||||
{-# LANGUAGE QuasiQuotes #-}
|
||||
|
||||
module Simplex.Chat.Store.SQLite.Migrations.M20260926_link_notices where
|
||||
|
||||
import Database.SQLite.Simple (Query)
|
||||
import Database.SQLite.Simple.QQ (sql)
|
||||
|
||||
m20260926_link_notices :: Query
|
||||
m20260926_link_notices =
|
||||
[sql|
|
||||
CREATE TABLE link_notices(
|
||||
link_notice_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
link_hash BLOB NOT NULL,
|
||||
expires_at TEXT,
|
||||
reason TEXT,
|
||||
created_at TEXT NOT NULL,
|
||||
updated_at TEXT NOT NULL
|
||||
) STRICT;
|
||||
|
||||
CREATE UNIQUE INDEX idx_link_notices_link_hash ON link_notices(link_hash);
|
||||
|]
|
||||
|
||||
down_m20260926_link_notices :: Query
|
||||
down_m20260926_link_notices =
|
||||
[sql|
|
||||
DROP INDEX idx_link_notices_link_hash;
|
||||
DROP TABLE link_notices;
|
||||
|]
|
||||
Reference in new issue
Block a user