chore: Änderungen commited
This commit is contained in:
38
migrations/versions/add_mindmap_shares_table.py
Normal file
38
migrations/versions/add_mindmap_shares_table.py
Normal file
@@ -0,0 +1,38 @@
|
||||
"""add mindmap shares table
|
||||
|
||||
Revision ID: add_mindmap_shares
|
||||
Revises: add_missing_user_fields
|
||||
Create Date: 2025-05-10 23:20:00.000000
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import sqlite
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'add_mindmap_shares'
|
||||
down_revision = 'add_missing_user_fields'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# Erstelle PermissionType Enum
|
||||
op.create_table('mindmap_share',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('mindmap_id', sa.Integer(), nullable=False),
|
||||
sa.Column('shared_by_id', sa.Integer(), nullable=False),
|
||||
sa.Column('shared_with_id', sa.Integer(), nullable=False),
|
||||
sa.Column('permission_type', sa.String(20), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(), nullable=True),
|
||||
sa.Column('last_accessed', sa.DateTime(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['mindmap_id'], ['user_mindmap.id'], ),
|
||||
sa.ForeignKeyConstraint(['shared_by_id'], ['user.id'], ),
|
||||
sa.ForeignKeyConstraint(['shared_with_id'], ['user.id'], ),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('mindmap_id', 'shared_with_id', name='unique_mindmap_share')
|
||||
)
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_table('mindmap_share')
|
||||
Reference in New Issue
Block a user