Sprava eventu a organizaci, bugfixing a drobny refaktoring
This commit is contained in:
+50
@@ -0,0 +1,50 @@
|
||||
"""add from/to to event, organization to event
|
||||
|
||||
Revision ID: 39a62618eacb
|
||||
Revises: a09857ec9721
|
||||
Create Date: 2023-09-20 11:53:00.566736
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import mysql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '39a62618eacb'
|
||||
down_revision = 'a09857ec9721'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('aircraft_notes')
|
||||
op.add_column('event', sa.Column('event_from', sa.DateTime(), nullable=True))
|
||||
op.add_column('event', sa.Column('event_to', sa.DateTime(), nullable=True))
|
||||
op.add_column('event', sa.Column('organization_id', sa.Integer(), nullable=True))
|
||||
op.create_foreign_key(None, 'event', 'organization', ['organization_id'], ['id'])
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_constraint(None, 'event', type_='foreignkey')
|
||||
op.drop_column('event', 'organization_id')
|
||||
op.drop_column('event', 'event_to')
|
||||
op.drop_column('event', 'event_from')
|
||||
op.create_table('aircraft_notes',
|
||||
sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False),
|
||||
sa.Column('aircraft_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False),
|
||||
sa.Column('name', mysql.VARCHAR(length=128), nullable=False),
|
||||
sa.Column('description', mysql.TEXT(), nullable=False),
|
||||
sa.Column('is_public', mysql.TINYINT(display_width=1), server_default=sa.text('0'), autoincrement=False, nullable=False),
|
||||
sa.Column('created_by_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False),
|
||||
sa.Column('created_at', mysql.DATETIME(), server_default=sa.text('current_timestamp()'), nullable=False),
|
||||
sa.ForeignKeyConstraint(['aircraft_id'], ['aircraft.id'], name='aircraft_notes_ibfk_1'),
|
||||
sa.ForeignKeyConstraint(['created_by_id'], ['user.id'], name='aircraft_notes_ibfk_2'),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
mysql_collate='utf8mb4_general_ci',
|
||||
mysql_default_charset='utf8mb4',
|
||||
mysql_engine='InnoDB'
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
Reference in New Issue
Block a user