|
|
@@ -0,0 +1,45 @@
|
|
|
+"""Add WiFi credentials to organizations
|
|
|
+
|
|
|
+Revision ID: 277d91f6540f
|
|
|
+Revises: 2affe85d6033
|
|
|
+Create Date: 2025-12-28 14:33:41.270496+00:00
|
|
|
+
|
|
|
+"""
|
|
|
+from typing import Sequence, Union
|
|
|
+
|
|
|
+from alembic import op
|
|
|
+import sqlalchemy as sa
|
|
|
+from sqlalchemy.dialects import postgresql
|
|
|
+
|
|
|
+# revision identifiers, used by Alembic.
|
|
|
+revision: str = '277d91f6540f'
|
|
|
+down_revision: Union[str, None] = '2affe85d6033'
|
|
|
+branch_labels: Union[str, Sequence[str], None] = None
|
|
|
+depends_on: Union[str, Sequence[str], None] = None
|
|
|
+
|
|
|
+
|
|
|
+def upgrade() -> None:
|
|
|
+ # ### commands auto generated by Alembic - please adjust! ###
|
|
|
+ op.drop_table('settings')
|
|
|
+ op.drop_constraint(op.f('devices_device_token_key'), 'devices', type_='unique')
|
|
|
+ op.create_unique_constraint(op.f('uq_devices_device_token'), 'devices', ['device_token'])
|
|
|
+ op.add_column('organizations', sa.Column('wifi_ssid', sa.String(length=100), nullable=True))
|
|
|
+ op.add_column('organizations', sa.Column('wifi_password_encrypted', sa.String(length=500), nullable=True))
|
|
|
+ # ### end Alembic commands ###
|
|
|
+
|
|
|
+
|
|
|
+def downgrade() -> None:
|
|
|
+ # ### commands auto generated by Alembic - please adjust! ###
|
|
|
+ op.drop_column('organizations', 'wifi_password_encrypted')
|
|
|
+ op.drop_column('organizations', 'wifi_ssid')
|
|
|
+ op.drop_constraint(op.f('uq_devices_device_token'), 'devices', type_='unique')
|
|
|
+ op.create_unique_constraint(op.f('devices_device_token_key'), 'devices', ['device_token'], postgresql_nulls_not_distinct=False)
|
|
|
+ op.create_table('settings',
|
|
|
+ sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
|
|
|
+ sa.Column('key', sa.VARCHAR(length=255), autoincrement=False, nullable=False),
|
|
|
+ sa.Column('value', postgresql.JSONB(astext_type=sa.Text()), autoincrement=False, nullable=False),
|
|
|
+ sa.Column('updated_at', postgresql.TIMESTAMP(), server_default=sa.text('now()'), autoincrement=False, nullable=True),
|
|
|
+ sa.PrimaryKeyConstraint('id', name=op.f('settings_pkey')),
|
|
|
+ sa.UniqueConstraint('key', name=op.f('settings_key_key'), postgresql_include=[], postgresql_nulls_not_distinct=False)
|
|
|
+ )
|
|
|
+ # ### end Alembic commands ###
|