From 603ae506f2a673b2aaa9595b1b92e20ee1b26ac7 Mon Sep 17 00:00:00 2001 From: mihalin Date: Wed, 19 Jan 2022 00:09:23 +0300 Subject: [PATCH] banned migration --- olgram/migrations/models/6_20220119000000_banned.sql | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 olgram/migrations/models/6_20220119000000_banned.sql diff --git a/olgram/migrations/models/6_20220119000000_banned.sql b/olgram/migrations/models/6_20220119000000_banned.sql new file mode 100644 index 0000000..b9eb149 --- /dev/null +++ b/olgram/migrations/models/6_20220119000000_banned.sql @@ -0,0 +1,11 @@ +-- upgrade -- +CREATE TABLE IF NOT EXISTS "bot_banned_user" ( + "id" BIGSERIAL NOT NULL PRIMARY KEY, + "telegram_id" BIGINT NOT NULL, + "username" VARCHAR(100), + "bot_id" INT NOT NULL REFERENCES "bot" ("id") ON DELETE CASCADE +); +CREATE INDEX IF NOT EXISTS "idx_bot_banned__telegra_915aca" ON "bot_banned_user" ("telegram_id"); +-- downgrade -- +DROP TABLE IF EXISTS "bot_banned_user"; +DROP INDEX IF EXISTS "idx_bot_banned__telegra_915aca";