Auth works again; relationships between Trashbox and User added

This commit is contained in:
2023-08-08 01:22:47 +03:00
parent d3d7760c5b
commit 832a2ce985
8 changed files with 185 additions and 43 deletions

View File

@ -0,0 +1,34 @@
"""email->nickname in User model
Revision ID: 58290a82b821
Revises: 9c19b9658512
Create Date: 2023-08-07 23:37:58.017279
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '58290a82b821'
down_revision = '9c19b9658512'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('users', schema=None) as batch_op:
batch_op.add_column(sa.Column('nickname', sa.String(), nullable=True))
batch_op.drop_column('email')
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('users', schema=None) as batch_op:
batch_op.add_column(sa.Column('email', sa.VARCHAR(), nullable=True))
batch_op.drop_column('nickname')
# ### end Alembic commands ###

View File

@ -0,0 +1,28 @@
"""created relationships between Trashbox and User
Revision ID: 96470e6327e0
Revises: b806af0cc2cb
Create Date: 2023-08-08 00:06:18.745504
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '96470e6327e0'
down_revision = 'b806af0cc2cb'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
pass
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
pass
# ### end Alembic commands ###

View File

@ -0,0 +1,28 @@
"""created relationships between Trashbox and User
Revision ID: b806af0cc2cb
Revises: 58290a82b821
Create Date: 2023-08-08 00:05:55.175838
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'b806af0cc2cb'
down_revision = '58290a82b821'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
pass
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
pass
# ### end Alembic commands ###

View File

@ -0,0 +1,36 @@
"""created relationships between Trashbox and User; (foreign key added to Trashbox table)
Revision ID: ee035dd94fbb
Revises: 96470e6327e0
Create Date: 2023-08-08 00:11:35.443724
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'ee035dd94fbb'
down_revision = '96470e6327e0'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('trashboxes', schema=None) as batch_op:
batch_op.add_column(sa.Column('user_id', sa.Integer(), nullable=True))
batch_op.add_column(sa.Column('date_of_chose', sa.Date(), nullable=True))
# batch_op.create_foreign_key(None, 'users', ['user_id'], ['id'])
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('trashboxes', schema=None) as batch_op:
# batch_op.drop_constraint(None, type_='foreignkey')
batch_op.drop_column('date_of_chose')
batch_op.drop_column('user_id')
# ### end Alembic commands ###