-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
abyrne
committed
Nov 9, 2023
1 parent
71dedfc
commit 420d509
Showing
1 changed file
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
"""empty message | ||
Revision ID: 4799661c144e | ||
Revises: 7086ad09e884 | ||
Create Date: 2023-11-09 17:27:00.506785 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = '4799661c144e' | ||
down_revision = '7086ad09e884' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.create_table('groups', | ||
sa.Column('group_id', sa.BigInteger(), nullable=False), | ||
sa.Column('name', sa.String(length=36), nullable=True), | ||
sa.Column('creator_id', sa.BigInteger(), nullable=True), | ||
sa.Column('owner_id', sa.BigInteger(), nullable=True), | ||
sa.Column('created_on', sa.DateTime(), nullable=True), | ||
sa.Column('deleted', sa.Boolean(), nullable=True), | ||
sa.ForeignKeyConstraint(['creator_id'], ['users.user_id'], name=op.f('fk_groups_creator_id_users')), | ||
sa.ForeignKeyConstraint(['owner_id'], ['users.user_id'], name=op.f('fk_groups_owner_id_users')), | ||
sa.PrimaryKeyConstraint('group_id', name=op.f('pk_groups')) | ||
) | ||
with op.batch_alter_table('groups', schema=None) as batch_op: | ||
batch_op.create_index(batch_op.f('ix_groups_creator_id'), ['creator_id'], unique=False) | ||
batch_op.create_index(batch_op.f('ix_groups_owner_id'), ['owner_id'], unique=False) | ||
|
||
op.create_table('group_memberships', | ||
sa.Column('user_id', sa.BigInteger(), nullable=False), | ||
sa.Column('group_id', sa.BigInteger(), nullable=False), | ||
sa.Column('read', sa.Boolean(), nullable=True), | ||
sa.Column('write', sa.Boolean(), nullable=True), | ||
sa.Column('share_read', sa.Boolean(), nullable=True), | ||
sa.Column('share_write', sa.Boolean(), nullable=True), | ||
sa.ForeignKeyConstraint(['group_id'], ['groups.group_id'], name=op.f('fk_group_memberships_group_id_groups')), | ||
sa.ForeignKeyConstraint(['user_id'], ['users.user_id'], name=op.f('fk_group_memberships_user_id_users')), | ||
sa.PrimaryKeyConstraint('user_id', 'group_id', name=op.f('pk_group_memberships')) | ||
) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_table('group_memberships') | ||
with op.batch_alter_table('groups', schema=None) as batch_op: | ||
batch_op.drop_index(batch_op.f('ix_groups_owner_id')) | ||
batch_op.drop_index(batch_op.f('ix_groups_creator_id')) | ||
|
||
op.drop_table('groups') | ||
# ### end Alembic commands ### |