2020-07-08 23:45:24 +02:00
|
|
|
"""empty message
|
|
|
|
|
|
|
|
Revision ID: cb6ab141c522
|
|
|
|
Revises: 7a48dbd05780
|
|
|
|
Create Date: 2020-07-08 21:03:51.856561
|
|
|
|
|
|
|
|
"""
|
|
|
|
import sqlalchemy as sa
|
2020-12-04 03:23:04 +01:00
|
|
|
from alembic import op
|
2023-05-13 18:53:21 +02:00
|
|
|
from sqlalchemy import orm, text
|
2020-07-08 23:45:24 +02:00
|
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
|
|
revision = 'cb6ab141c522'
|
|
|
|
down_revision = '7a48dbd05780'
|
|
|
|
branch_labels = None
|
|
|
|
depends_on = None
|
|
|
|
|
|
|
|
|
|
|
|
def upgrade():
|
|
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
|
|
op.create_table('maintainers',
|
|
|
|
sa.Column('user_id', sa.Integer(), nullable=False),
|
|
|
|
sa.Column('package_id', sa.Integer(), nullable=False),
|
|
|
|
sa.ForeignKeyConstraint(['package_id'], ['package.id'], ),
|
|
|
|
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
|
|
|
|
sa.PrimaryKeyConstraint('user_id', 'package_id')
|
|
|
|
)
|
|
|
|
|
|
|
|
bind = op.get_bind()
|
|
|
|
session = orm.Session(bind=bind)
|
|
|
|
|
2023-05-13 18:53:21 +02:00
|
|
|
op.execute(text('INSERT INTO maintainers (package_id, user_id) SELECT id, author_id FROM package;'))
|
2020-07-08 23:45:24 +02:00
|
|
|
|
|
|
|
session.commit()
|
|
|
|
|
|
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
|
|
|
|
|
|
def downgrade():
|
|
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
|
|
op.drop_table('maintainers')
|
|
|
|
# ### end Alembic commands ###
|