From 2a7def4809e23270a89429d9e6a05c64dfafef6f Mon Sep 17 00:00:00 2001 From: mihalin Date: Sat, 11 Sep 2021 18:27:04 +0300 Subject: [PATCH] =?UTF-8?q?bigint=20=D0=94=D0=BB=D1=8F=20=D0=B8=D0=B4?= =?UTF-8?q?=D0=B5=D0=BD=D1=82=D0=B8=D1=84=D0=BA=D0=B0=D1=82=D0=BE=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=20=D1=87=D0=B0=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- olgram/migrations/models/2_20210911182503_update.sql | 6 ++++++ olgram/models/models.py | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 olgram/migrations/models/2_20210911182503_update.sql diff --git a/olgram/migrations/models/2_20210911182503_update.sql b/olgram/migrations/models/2_20210911182503_update.sql new file mode 100644 index 0000000..2ddc87f --- /dev/null +++ b/olgram/migrations/models/2_20210911182503_update.sql @@ -0,0 +1,6 @@ +-- upgrade -- +ALTER TABLE "group_chat" ALTER COLUMN "chat_id" TYPE BIGINT USING "chat_id"::BIGINT; +ALTER TABLE "user" ALTER COLUMN "telegram_id" TYPE BIGINT USING "telegram_id"::BIGINT; +-- downgrade -- +ALTER TABLE "user" ALTER COLUMN "telegram_id" TYPE INT USING "telegram_id"::INT; +ALTER TABLE "group_chat" ALTER COLUMN "chat_id" TYPE INT USING "chat_id"::INT; diff --git a/olgram/models/models.py b/olgram/models/models.py index 16bd2fa..b597ac9 100644 --- a/olgram/models/models.py +++ b/olgram/models/models.py @@ -33,7 +33,7 @@ class Bot(Model): class User(Model): id = fields.IntField(pk=True) - telegram_id = fields.IntField(index=True, unique=True) + telegram_id = fields.BigIntField(index=True, unique=True) class Meta: table = 'user' @@ -41,7 +41,7 @@ class User(Model): class GroupChat(Model): id = fields.IntField(pk=True) - chat_id = fields.IntField(index=True, unique=True) + chat_id = fields.BigIntField(index=True, unique=True) name = fields.CharField(max_length=50) class Meta: