Spaces:
Sleeping
Sleeping
"""Add users, transactions tables | |
Revision ID: cd515c44401d | |
Revises: | |
Create Date: 2024-06-01 01:32:42.500524 | |
""" | |
from typing import Sequence, Union | |
from alembic import op | |
import sqlalchemy as sa | |
# revision identifiers, used by Alembic. | |
revision: str = 'cd515c44401d' | |
down_revision: Union[str, None] = None | |
branch_labels: Union[str, Sequence[str], None] = None | |
depends_on: Union[str, Sequence[str], None] = None | |
def upgrade() -> None: | |
# ### commands auto generated by Alembic - please adjust! ### | |
op.create_table('users', | |
sa.Column('name', sa.String(), nullable=True), | |
sa.Column('email', sa.String(), nullable=True), | |
sa.Column('id', sa.Integer(), nullable=False), | |
sa.Column('created_at', sa.DateTime(), nullable=True), | |
sa.Column('updated_at', sa.DateTime(), nullable=True), | |
sa.PrimaryKeyConstraint('id') | |
) | |
op.create_index(op.f('ix_users_id'), 'users', ['id'], unique=False) | |
op.create_table('transactions', | |
sa.Column('transaction_date', sa.DateTime(), nullable=True), | |
sa.Column('category', sa.String(), nullable=True), | |
sa.Column('name_description', sa.String(), nullable=True), | |
sa.Column('amount', sa.Float(), nullable=True), | |
sa.Column('type', sa.String(), nullable=True), | |
sa.Column('user_id', sa.Integer(), nullable=True), | |
sa.Column('id', sa.Integer(), nullable=False), | |
sa.Column('created_at', sa.DateTime(), nullable=True), | |
sa.Column('updated_at', sa.DateTime(), nullable=True), | |
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ), | |
sa.PrimaryKeyConstraint('id') | |
) | |
op.create_index(op.f('ix_transactions_id'), 'transactions', ['id'], unique=False) | |
# ### end Alembic commands ### | |
def downgrade() -> None: | |
# ### commands auto generated by Alembic - please adjust! ### | |
op.drop_index(op.f('ix_transactions_id'), table_name='transactions') | |
op.drop_table('transactions') | |
op.drop_index(op.f('ix_users_id'), table_name='users') | |
op.drop_table('users') | |
# ### end Alembic commands ### | |