Skip to content

Commit b2224f8

Browse files
author
Kacper Zienkiewicz
committed
[#93048] server: tests: Pass test_model_definitions_match_ddl
sa.String() was turning into VARCHAR, contrary to the DDL definitions which were denoting these fields as TEXT
1 parent 3c0669e commit b2224f8

6 files changed

Lines changed: 9 additions & 7 deletions

File tree

server/alembic/versions/5_add_tags.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
def upgrade() -> None:
2222
op.create_table('devices_tags',
2323
sa.Column('device_id', sa.Integer(), nullable=False),
24-
sa.Column('tag', sa.String(), nullable=False),
24+
sa.Column('tag', sa.Text(), nullable=False),
2525
sa.ForeignKeyConstraint(['device_id'], ['devices.id'], ondelete='RESTRICT'),
2626
sa.PrimaryKeyConstraint('device_id', 'tag')
2727
)

server/alembic/versions/6_add_action_logs.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
def upgrade() -> None:
2222
op.create_table('action_logs',
2323
sa.Column('id', sa.String(), nullable=False),
24-
sa.Column('action_id', sa.String(), nullable=False),
25-
sa.Column('mac_address', sa.String(), nullable=False),
24+
sa.Column('action_id', sa.Text(), nullable=False),
25+
sa.Column('mac_address', sa.Text(), nullable=False),
2626
sa.Column('created', sa.DateTime(), nullable=False),
27-
sa.Column('status', sa.String(), nullable=False),
27+
sa.Column('status', sa.Text(), nullable=False),
2828
sa.PrimaryKeyConstraint('id'),
2929
)
3030

server/alembic/versions/7_add_device_updates.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
def upgrade() -> None:
2222
op.create_table('device_updates',
2323
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
24-
sa.Column('mac_address', sa.String(), nullable=False),
24+
sa.Column('mac_address', sa.Text(), nullable=False),
2525
sa.Column('created', sa.DateTime(), nullable=False),
26-
sa.Column('version', sa.String(), nullable=False),
26+
sa.Column('version', sa.Text(), nullable=False),
2727
sa.Column('progress', sa.Integer(), nullable=False),
2828
sa.PrimaryKeyConstraint('id'),
2929
)

server/alembic/versions/9_action_log_url.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020

2121
def upgrade() -> None:
22-
op.add_column('action_logs', sa.Column('download_url', sa.String(), nullable=True))
22+
op.add_column('action_logs', sa.Column('download_url', sa.Text(), nullable=True))
2323

2424

2525
def downgrade() -> None:

server/src/models/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66
from models.log import Log
77
from models.permission import Permission
88
from models.action_log import ActionLog
9+
from models.device_update import DeviceUpdate

server/tests/test-alembic-migrations.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# This tests the whole migration chain down to up.
55
# It is parametrized to run on PostgreSQL and SQLite.
66
from pytest_alembic.tests import test_upgrade
7+
from pytest_alembic.tests import test_model_definitions_match_ddl
78

89
def test_migration_8(alembic_engine, alembic_runner):
910
"""

0 commit comments

Comments
 (0)