Skip to content

Commit edfa5c7

Browse files
fix-bots-actions (#160)
1 parent d66f103 commit edfa5c7

File tree

2 files changed

+64
-2
lines changed

2 files changed

+64
-2
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
"""bot-actions-fix
2+
3+
Revision ID: 80e114fe1399
4+
Revises: d1a22199f353
5+
Create Date: 2025-07-05 15:43:04.340488
6+
7+
"""
8+
9+
import os
10+
11+
import sqlalchemy as sa
12+
from alembic import op
13+
14+
15+
revision = '80e114fe1399'
16+
down_revision = 'd1a22199f353'
17+
branch_labels = None
18+
depends_on = None
19+
20+
21+
def upgrade():
22+
op.alter_column(
23+
'printer_bots_actions',
24+
'user_id',
25+
existing_type=sa.INTEGER(),
26+
type_=sa.String(),
27+
existing_comment='Айди юзера в соответствующей соцсети(tg/vk)',
28+
existing_nullable=False,
29+
schema='ODS_MARKETING',
30+
)
31+
op.alter_column(
32+
'printer_bots_actions',
33+
'number',
34+
existing_type=sa.INTEGER(),
35+
type_=sa.String(),
36+
existing_comment='Номер',
37+
existing_nullable=False,
38+
schema='ODS_MARKETING',
39+
)
40+
41+
42+
def downgrade():
43+
op.alter_column(
44+
'printer_bots_actions',
45+
'number',
46+
existing_type=sa.String(),
47+
type_=sa.INTEGER(),
48+
existing_comment='Номер',
49+
existing_nullable=False,
50+
schema='ODS_MARKETING',
51+
postgresql_using='number::integer',
52+
)
53+
op.alter_column(
54+
'printer_bots_actions',
55+
'user_id',
56+
existing_type=sa.String(),
57+
type_=sa.INTEGER(),
58+
existing_comment='Айди юзера в соответствующей соцсети(tg/vk)',
59+
existing_nullable=False,
60+
schema='ODS_MARKETING',
61+
postgresql_using='user_id::integer',
62+
)

profcomff_definitions/ODS/marketing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ class PrinterBotsActions(Base):
4545
path_from: Mapped[str | None] = mapped_column(comment="Откуда совершен переход")
4646
path_to: Mapped[str | None] = mapped_column(comment="Назначение перехода")
4747
status: Mapped[str] = mapped_column(comment="Статус действия")
48-
user_id: Mapped[int] = mapped_column(comment="Айди юзера в соответствующей соцсети(tg/vk)")
48+
user_id: Mapped[str] = mapped_column(comment="Айди юзера в соответствующей соцсети(tg/vk)")
4949
surname: Mapped[str] = mapped_column(comment='Фамилия юзера')
50-
number: Mapped[int] = mapped_column(comment="Номер")
50+
number: Mapped[str] = mapped_column(comment="Номер")
5151
pin: Mapped[int | None]
5252
status_code: Mapped[int | None] = mapped_column(comment="Код ошибки")
5353
description: Mapped[str | None] = mapped_column(comment="Описание ошибки")

0 commit comments

Comments
 (0)