]> git.aero2k.de Git - sirius.git/commitdiff
fix to allow migrations tool to detect models
authorMatt Webb <matt@interconnected.org>
Sat, 27 Sep 2014 12:38:45 +0000 (13:38 +0100)
committerMatt Webb <matt@interconnected.org>
Sat, 27 Sep 2014 12:38:45 +0000 (13:38 +0100)
app/models/__init__.py
migrations/versions/25f387c51cf0_.py [new file with mode: 0644]

index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..c2be36fd052c4c76c45c087a0929e49558c622f0 100644 (file)
@@ -0,0 +1,3 @@
+# the top-level models module needs to import all models so that the
+# database migration tool can detect them
+from .core import BridgeCommand, DeviceCommand, Bridge, Device, PendingClaim
\ No newline at end of file
diff --git a/migrations/versions/25f387c51cf0_.py b/migrations/versions/25f387c51cf0_.py
new file mode 100644 (file)
index 0000000..189305e
--- /dev/null
@@ -0,0 +1,63 @@
+"""empty message
+
+Revision ID: 25f387c51cf0
+Revises: 595254b6b6e9
+Create Date: 2014-09-27 13:36:50.512627
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '25f387c51cf0'
+down_revision = '595254b6b6e9'
+
+from alembic import op
+import sqlalchemy as sa
+
+
+def upgrade():
+    ### commands auto generated by Alembic - please adjust! ###
+    op.create_table('device_commands',
+    sa.Column('id', sa.Integer(), nullable=False),
+    sa.Column('device_address', sa.String(), nullable=False),
+    sa.Column('binary_payload', sa.Text(), nullable=False),
+    sa.Column('state', sa.Enum('ready', 'failed', 'delivered', 'skipped'), nullable=False),
+    sa.Column('deliver_at', sa.DateTime(), nullable=False),
+    sa.Column('return_code', sa.SmallInteger(), nullable=True),
+    sa.PrimaryKeyConstraint('id')
+    )
+    op.create_table('bridges',
+    sa.Column('bridge_address', sa.String(), nullable=False),
+    sa.Column('last_power_on', sa.DateTime(), nullable=True),
+    sa.PrimaryKeyConstraint('bridge_address')
+    )
+    op.create_table('devices',
+    sa.Column('device_address', sa.String(), nullable=False),
+    sa.Column('hardware_xor', sa.Integer(), nullable=False),
+    sa.PrimaryKeyConstraint('device_address')
+    )
+    op.create_table('bridge_commands',
+    sa.Column('id', sa.Integer(), nullable=False),
+    sa.Column('timestamp', sa.DateTime(), nullable=False),
+    sa.Column('bridge_address', sa.String(), nullable=False),
+    sa.Column('json_payload', sa.UnicodeText(), nullable=False),
+    sa.Column('state', sa.Enum('ready', 'failed', 'delivered', 'skipped'), nullable=False),
+    sa.Column('return_code', sa.SmallInteger(), nullable=True),
+    sa.PrimaryKeyConstraint('id')
+    )
+    op.create_table('pending_claims',
+    sa.Column('id', sa.Integer(), nullable=False),
+    sa.Column('claim_code', sa.String(), nullable=False),
+    sa.Column('hardware_xor', sa.String(), nullable=False),
+    sa.PrimaryKeyConstraint('id')
+    )
+    ### end Alembic commands ###
+
+
+def downgrade():
+    ### commands auto generated by Alembic - please adjust! ###
+    op.drop_table('pending_claims')
+    op.drop_table('bridge_commands')
+    op.drop_table('devices')
+    op.drop_table('bridges')
+    op.drop_table('device_commands')
+    ### end Alembic commands ###