From: Matt Webb Date: Sat, 27 Sep 2014 12:38:45 +0000 (+0100) Subject: fix to allow migrations tool to detect models X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=48c3198ba9cc923147a000761cc1dff00394a0b0;p=sirius.git fix to allow migrations tool to detect models --- diff --git a/app/models/__init__.py b/app/models/__init__.py index e69de29..c2be36f 100644 --- a/app/models/__init__.py +++ b/app/models/__init__.py @@ -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 index 0000000..189305e --- /dev/null +++ b/migrations/versions/25f387c51cf0_.py @@ -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 ###