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: