diff --git a/alembic/env.py b/alembic/env.py index 948701f..5897a08 100644 --- a/alembic/env.py +++ b/alembic/env.py @@ -31,7 +31,7 @@ async def run_migrations_online(): and associate a connection with the context. """ - connectable = create_async_engine(settings.asyncpg_url, future=True) + connectable = create_async_engine(settings.asyncpg_url.unicode_string(), future=True) async with connectable.connect() as connection: await connection.run_sync(do_run_migrations) diff --git a/alembic/versions/20230722_1219_2dcc708f88f8_user_auth.py b/alembic/versions/20230722_1219_2dcc708f88f8_user_auth.py new file mode 100644 index 0000000..b6c4bed --- /dev/null +++ b/alembic/versions/20230722_1219_2dcc708f88f8_user_auth.py @@ -0,0 +1,40 @@ +"""user auth + +Revision ID: 2dcc708f88f8 +Revises: 0d1ee3949d21 +Create Date: 2023-07-22 12:19:28.780926 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '2dcc708f88f8' +down_revision = '0d1ee3949d21' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.create_table('user', + sa.Column('uuid', sa.UUID(), nullable=False), + sa.Column('email', sa.String(), nullable=False), + sa.Column('first_name', sa.String(), nullable=False), + sa.Column('last_name', sa.String(), nullable=False), + sa.Column('password', sa.LargeBinary(), nullable=False), + sa.PrimaryKeyConstraint('uuid'), + sa.UniqueConstraint('uuid') + ) + op.create_unique_constraint(None, 'nonsense', ['name'], schema='happy_hog') + op.create_unique_constraint(None, 'stuff', ['name'], schema='happy_hog') + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.drop_constraint(None, 'stuff', schema='happy_hog', type_='unique') + op.drop_constraint(None, 'nonsense', schema='happy_hog', type_='unique') + op.drop_table('user') + # ### end Alembic commands ### diff --git a/app/models/__init__.py b/app/models/__init__.py index 5315b1d..0911d6f 100644 --- a/app/models/__init__.py +++ b/app/models/__init__.py @@ -2,3 +2,4 @@ from app.models.nonsense import * # noqa from app.models.shakespeare import * # noqa from app.models.stuff import * # noqa +from app.models.user import * # noqa