aboutsummaryrefslogtreecommitdiff
path: root/migrations
diff options
context:
space:
mode:
authorGertjan van den Burg <gertjanvandenburg@gmail.com>2019-03-18 14:42:23 +0000
committerGertjan van den Burg <gertjanvandenburg@gmail.com>2019-03-18 14:42:23 +0000
commitca0586953fa0da443ab54eb960bf90a8fbdeed7d (patch)
treed85e112174f050a2271d39060dbfe640fd10722a /migrations
parentinitial commit (diff)
downloadAnnotateChange-ca0586953fa0da443ab54eb960bf90a8fbdeed7d.tar.gz
AnnotateChange-ca0586953fa0da443ab54eb960bf90a8fbdeed7d.zip
add registration
Diffstat (limited to 'migrations')
-rw-r--r--migrations/versions/f3622e20dd86_initialize.py67
1 files changed, 67 insertions, 0 deletions
diff --git a/migrations/versions/f3622e20dd86_initialize.py b/migrations/versions/f3622e20dd86_initialize.py
new file mode 100644
index 0000000..545ca5b
--- /dev/null
+++ b/migrations/versions/f3622e20dd86_initialize.py
@@ -0,0 +1,67 @@
+"""initialize
+
+Revision ID: f3622e20dd86
+Revises:
+Create Date: 2019-03-18 14:11:22.386217
+
+"""
+from alembic import op
+import sqlalchemy as sa
+
+
+# revision identifiers, used by Alembic.
+revision = 'f3622e20dd86'
+down_revision = None
+branch_labels = None
+depends_on = None
+
+
+def upgrade():
+ # ### commands auto generated by Alembic - please adjust! ###
+ op.create_table('dataset',
+ sa.Column('id', sa.Integer(), nullable=False),
+ sa.Column('name', sa.String(), nullable=False),
+ sa.Column('created', sa.DateTime(), nullable=False),
+ sa.Column('md5sum', sa.String(length=32), nullable=False),
+ sa.PrimaryKeyConstraint('id'),
+ sa.UniqueConstraint('md5sum'),
+ sa.UniqueConstraint('name')
+ )
+ op.create_table('user',
+ sa.Column('id', sa.Integer(), nullable=False),
+ sa.Column('username', sa.String(length=80), nullable=False),
+ sa.Column('email', sa.String(), nullable=False),
+ sa.Column('password_hash', sa.String(length=128), nullable=False),
+ sa.Column('last_active', sa.DateTime(), nullable=False),
+ sa.PrimaryKeyConstraint('id'),
+ sa.UniqueConstraint('email'),
+ sa.UniqueConstraint('username')
+ )
+ op.create_table('task',
+ sa.Column('id', sa.Integer(), nullable=False),
+ sa.Column('done', sa.Boolean(), nullable=False),
+ sa.Column('annotated_on', sa.DateTime(), nullable=True),
+ sa.Column('annotator_id', sa.Integer(), nullable=True),
+ sa.Column('dataset_id', sa.Integer(), nullable=True),
+ sa.ForeignKeyConstraint(['annotator_id'], ['user.id'], ),
+ sa.ForeignKeyConstraint(['dataset_id'], ['dataset.id'], ),
+ sa.PrimaryKeyConstraint('id')
+ )
+ op.create_table('annotation',
+ sa.Column('id', sa.Integer(), nullable=False),
+ sa.Column('time_start', sa.Integer(), nullable=True),
+ sa.Column('time_end', sa.Integer(), nullable=True),
+ sa.Column('task_id', sa.Integer(), nullable=True),
+ sa.ForeignKeyConstraint(['task_id'], ['task.id'], ),
+ sa.PrimaryKeyConstraint('id')
+ )
+ # ### end Alembic commands ###
+
+
+def downgrade():
+ # ### commands auto generated by Alembic - please adjust! ###
+ op.drop_table('annotation')
+ op.drop_table('task')
+ op.drop_table('user')
+ op.drop_table('dataset')
+ # ### end Alembic commands ###