aboutsummaryrefslogtreecommitdiff
path: root/migrations/versions/81173c1d4f0a_initial_migration.py
diff options
context:
space:
mode:
authorCara Salter <cara@devcara.com>2022-08-24 13:15:31 -0400
committerCara Salter <cara@devcara.com>2022-08-24 13:15:31 -0400
commit9de84e3fbae0f2893e9c4f1425afa06899959bf7 (patch)
treef96d33d881954edc9b03df0bc821fb35eb59c577 /migrations/versions/81173c1d4f0a_initial_migration.py
parent4b616447715b8129ae322341959e1c2bfabbd10e (diff)
downloadnccd-9de84e3fbae0f2893e9c4f1425afa06899959bf7.tar.gz
nccd-9de84e3fbae0f2893e9c4f1425afa06899959bf7.zip
flaskify
Diffstat (limited to 'migrations/versions/81173c1d4f0a_initial_migration.py')
-rw-r--r--migrations/versions/81173c1d4f0a_initial_migration.py90
1 files changed, 90 insertions, 0 deletions
diff --git a/migrations/versions/81173c1d4f0a_initial_migration.py b/migrations/versions/81173c1d4f0a_initial_migration.py
new file mode 100644
index 0000000..f96ff21
--- /dev/null
+++ b/migrations/versions/81173c1d4f0a_initial_migration.py
@@ -0,0 +1,90 @@
+"""Initial migration
+
+Revision ID: 81173c1d4f0a
+Revises:
+Create Date: 2022-07-25 13:13:29.135474
+
+"""
+from alembic import op
+import sqlalchemy as sa
+from sqlalchemy.dialects import postgresql
+
+# revision identifiers, used by Alembic.
+revision = '81173c1d4f0a'
+down_revision = None
+branch_labels = None
+depends_on = None
+
+
+def upgrade():
+ # ### commands auto generated by Alembic - please adjust! ###
+ op.create_table('role',
+ sa.Column('id', sa.String(), nullable=False),
+ sa.Column('name', sa.String(), nullable=True),
+ sa.Column('description', sa.String(), nullable=True),
+ sa.PrimaryKeyConstraint('id'),
+ sa.UniqueConstraint('name')
+ )
+ op.create_table('user',
+ sa.Column('id', sa.String(), nullable=False),
+ sa.Column('email', sa.String(), nullable=False),
+ sa.Column('password', sa.String(), nullable=False),
+ sa.Column('pref_name', sa.String(), nullable=False),
+ sa.Column('last_login', sa.DateTime(), nullable=False),
+ sa.Column('fs_uniquifier', sa.String(), nullable=False),
+ sa.Column('active', sa.Boolean(), nullable=False),
+ sa.PrimaryKeyConstraint('id'),
+ sa.UniqueConstraint('email'),
+ sa.UniqueConstraint('fs_uniquifier')
+ )
+ op.drop_table('enroll_requests')
+ op.drop_table('_sqlx_migrations')
+ op.drop_table('networks')
+ op.drop_table('peers')
+ op.drop_table('users')
+ # ### end Alembic commands ###
+
+
+def downgrade():
+ # ### commands auto generated by Alembic - please adjust! ###
+ op.create_table('users',
+ sa.Column('id', sa.TEXT(), autoincrement=False, nullable=False),
+ sa.Column('email', sa.TEXT(), autoincrement=False, nullable=False),
+ sa.Column('pref_name', sa.TEXT(), autoincrement=False, nullable=False),
+ sa.Column('pw_hash', sa.TEXT(), autoincrement=False, nullable=False),
+ sa.Column('last_login', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
+ sa.PrimaryKeyConstraint('id', name='users_pkey'),
+ postgresql_ignore_search_path=False
+ )
+ op.create_table('peers',
+ sa.Column('id', sa.TEXT(), autoincrement=False, nullable=False),
+ sa.Column('addr', postgresql.CIDR(), autoincrement=False, nullable=False),
+ sa.Column('public_key', sa.TEXT(), autoincrement=False, nullable=False),
+ sa.Column('owner', sa.TEXT(), autoincrement=False, nullable=False),
+ sa.ForeignKeyConstraint(['owner'], ['users.id'], name='peers_owner_fkey'),
+ sa.PrimaryKeyConstraint('id', name='peers_pkey')
+ )
+ op.create_table('networks',
+ sa.Column('id', sa.TEXT(), autoincrement=False, nullable=False),
+ sa.Column('subnet', postgresql.CIDR(), autoincrement=False, nullable=False),
+ sa.Column('description', sa.TEXT(), autoincrement=False, nullable=True),
+ sa.PrimaryKeyConstraint('id', name='networks_pkey')
+ )
+ op.create_table('_sqlx_migrations',
+ sa.Column('version', sa.BIGINT(), autoincrement=False, nullable=False),
+ sa.Column('description', sa.TEXT(), autoincrement=False, nullable=False),
+ sa.Column('installed_on', postgresql.TIMESTAMP(timezone=True), server_default=sa.text('now()'), autoincrement=False, nullable=False),
+ sa.Column('success', sa.BOOLEAN(), autoincrement=False, nullable=False),
+ sa.Column('checksum', postgresql.BYTEA(), autoincrement=False, nullable=False),
+ sa.Column('execution_time', sa.BIGINT(), autoincrement=False, nullable=False),
+ sa.PrimaryKeyConstraint('version', name='_sqlx_migrations_pkey')
+ )
+ op.create_table('enroll_requests',
+ sa.Column('token', sa.TEXT(), autoincrement=False, nullable=False),
+ sa.Column('expires', postgresql.TIMESTAMP(), server_default=sa.text("(CURRENT_TIMESTAMP + ((30)::double precision * '00:01:00'::interval))"), autoincrement=False, nullable=False),
+ sa.Column('confirmed', sa.BOOLEAN(), server_default=sa.text('false'), autoincrement=False, nullable=False),
+ sa.PrimaryKeyConstraint('token', name='enroll_requests_pkey')
+ )
+ op.drop_table('user')
+ op.drop_table('role')
+ # ### end Alembic commands ###