mirror of
https://github.com/wowlikon/LiB.git
synced 2026-02-04 04:31:09 +00:00
Добавление выдач
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
"""Loans
|
||||
|
||||
Revision ID: 02ed6e775351
|
||||
Revises: b838606ad8d1
|
||||
Create Date: 2025-12-20 10:36:30.853896
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
import sqlmodel
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = '02ed6e775351'
|
||||
down_revision: Union[str, None] = 'b838606ad8d1'
|
||||
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! ###
|
||||
book_status_enum = sa.Enum('active', 'borrowed', 'reserved', 'restoration', 'written_off', name='bookstatus')
|
||||
book_status_enum.create(op.get_bind())
|
||||
op.create_table('book_loans',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('book_id', sa.Integer(), nullable=False),
|
||||
sa.Column('user_id', sa.Integer(), nullable=False),
|
||||
sa.Column('borrowed_at', sa.DateTime(), nullable=False),
|
||||
sa.Column('due_date', sa.DateTime(), nullable=False),
|
||||
sa.Column('returned_at', sa.DateTime(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['book_id'], ['book.id'], ),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_index(op.f('ix_book_loans_id'), 'book_loans', ['id'], unique=False)
|
||||
op.add_column('book', sa.Column('status', book_status_enum, nullable=False, server_default='active'))
|
||||
op.drop_index(op.f('ix_roles_name'), table_name='roles')
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_index(op.f('ix_roles_name'), 'roles', ['name'], unique=True)
|
||||
op.drop_column('book', 'status')
|
||||
op.drop_index(op.f('ix_book_loans_id'), table_name='book_loans')
|
||||
op.drop_table('book_loans')
|
||||
book_status_enum = sa.Enum('active', 'borrowed', 'reserved', 'restoration', 'written_off', name='bookstatus')
|
||||
book_status_enum.drop(op.get_bind())
|
||||
# ### end Alembic commands ###
|
||||
@@ -1,4 +1,4 @@
|
||||
"""genres
|
||||
"""Genres
|
||||
|
||||
Revision ID: 9d7a43ac5dfc
|
||||
Revises: d266fdc61e99
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""auth
|
||||
"""Auth
|
||||
|
||||
Revision ID: b838606ad8d1
|
||||
Revises: 9d7a43ac5dfc
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""init
|
||||
"""Init
|
||||
|
||||
Revision ID: d266fdc61e99
|
||||
Revises:
|
||||
|
||||
Reference in New Issue
Block a user