mirror of
https://github.com/spiral-project/ihatemoney.git
synced 2025-04-28 17:32:38 +02:00
78 lines
3 KiB
Python
78 lines
3 KiB
Python
"""remove currencies
|
|
|
|
Revision ID: 3334e1f293b4
|
|
Revises: 7a9b38559992
|
|
Create Date: 2024-12-27 00:25:06.517970
|
|
|
|
"""
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '3334e1f293b4'
|
|
down_revision = '7a9b38559992'
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
def upgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
with op.batch_alter_table('bill', schema=None) as batch_op:
|
|
batch_op.drop_column('converted_amount')
|
|
batch_op.drop_column('original_currency')
|
|
|
|
with op.batch_alter_table('bill_version', schema=None) as batch_op:
|
|
batch_op.alter_column('bill_type',
|
|
existing_type=sa.TEXT(),
|
|
type_=sa.Enum('EXPENSE', 'REIMBURSEMENT', name='billtype'),
|
|
existing_nullable=True,
|
|
autoincrement=False)
|
|
batch_op.drop_column('converted_amount')
|
|
batch_op.drop_column('original_currency')
|
|
|
|
with op.batch_alter_table('billowers', schema=None) as batch_op:
|
|
batch_op.alter_column('bill_id',
|
|
existing_type=sa.INTEGER(),
|
|
nullable=False)
|
|
batch_op.alter_column('person_id',
|
|
existing_type=sa.INTEGER(),
|
|
nullable=False)
|
|
|
|
with op.batch_alter_table('project', schema=None) as batch_op:
|
|
batch_op.drop_column('default_currency')
|
|
|
|
with op.batch_alter_table('project_version', schema=None) as batch_op:
|
|
batch_op.drop_column('default_currency')
|
|
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
with op.batch_alter_table('project_version', schema=None) as batch_op:
|
|
batch_op.add_column(sa.Column('default_currency', sa.VARCHAR(length=3), nullable=True))
|
|
|
|
with op.batch_alter_table('project', schema=None) as batch_op:
|
|
batch_op.add_column(sa.Column('default_currency', sa.VARCHAR(length=3), server_default=sa.text("('')"), nullable=True))
|
|
|
|
with op.batch_alter_table('billowers', schema=None) as batch_op:
|
|
batch_op.alter_column('person_id',
|
|
existing_type=sa.INTEGER(),
|
|
nullable=True)
|
|
batch_op.alter_column('bill_id',
|
|
existing_type=sa.INTEGER(),
|
|
nullable=True)
|
|
|
|
with op.batch_alter_table('bill_version', schema=None) as batch_op:
|
|
batch_op.add_column(sa.Column('original_currency', sa.VARCHAR(length=3), nullable=True))
|
|
batch_op.add_column(sa.Column('converted_amount', sa.FLOAT(), nullable=True))
|
|
batch_op.alter_column('bill_type',
|
|
existing_type=sa.Enum('EXPENSE', 'REIMBURSEMENT', name='billtype'),
|
|
type_=sa.TEXT(),
|
|
existing_nullable=True,
|
|
autoincrement=False)
|
|
|
|
with op.batch_alter_table('bill', schema=None) as batch_op:
|
|
batch_op.add_column(sa.Column('original_currency', sa.VARCHAR(length=3), server_default=sa.text("('')"), nullable=True))
|
|
batch_op.add_column(sa.Column('converted_amount', sa.FLOAT(), nullable=True))
|
|
|
|
# ### end Alembic commands ###
|