From 6c8bb99c6104b0178dc7e3bee1eb8adfae4f6cf9 Mon Sep 17 00:00:00 2001 From: TuxCoder Date: Sun, 20 Feb 2022 16:58:04 +0100 Subject: [PATCH] add init db --- migrations/versions/ff2f2e871dfc_init.py | 56 ++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 migrations/versions/ff2f2e871dfc_init.py diff --git a/migrations/versions/ff2f2e871dfc_init.py b/migrations/versions/ff2f2e871dfc_init.py new file mode 100644 index 0000000..201b18d --- /dev/null +++ b/migrations/versions/ff2f2e871dfc_init.py @@ -0,0 +1,56 @@ +"""init + +Revision ID: ff2f2e871dfc +Revises: +Create Date: 2022-02-20 16:56:13.258209 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = 'ff2f2e871dfc' +down_revision = None +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.create_table('user', + sa.Column('id', sa.String(length=36), nullable=False), + sa.Column('username', sa.String(), nullable=False), + sa.Column('alternative_email', sa.String(), nullable=True), + sa.Column('created_at', sa.DateTime(), nullable=False), + sa.Column('modified_at', sa.DateTime(), nullable=False), + sa.Column('last_login', sa.DateTime(), nullable=True), + sa.PrimaryKeyConstraint('id'), + sa.UniqueConstraint('username') + ) + op.create_table('user_sign_up', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('username', sa.String(), nullable=False), + sa.Column('password', sa.String(), nullable=False), + sa.Column('alternative_email', sa.String(), nullable=True), + sa.Column('created_at', sa.DateTime(), nullable=False), + sa.PrimaryKeyConstraint('id') + ) + op.create_table('totp', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('secret', sa.String(), nullable=False), + sa.Column('name', sa.String(), nullable=False), + sa.Column('created_at', sa.DateTime(), nullable=False), + sa.Column('user_id', sa.String(length=36), nullable=False), + sa.ForeignKeyConstraint(['user_id'], ['user.id'], ), + sa.PrimaryKeyConstraint('id') + ) + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.drop_table('totp') + op.drop_table('user_sign_up') + op.drop_table('user') + # ### end Alembic commands ###