Chore: Changed the Section Printer from Menu Categories to Sale Categories. This is more logical, in the older software, there as no concept of sale categories so menu categories was used.
This should make the whole thing much easier to update and read.
This commit is contained in:
73
barker/alembic/versions/81d94c5223a7_section_printer.py
Normal file
73
barker/alembic/versions/81d94c5223a7_section_printer.py
Normal file
@ -0,0 +1,73 @@
|
||||
"""section printer
|
||||
|
||||
Revision ID: 81d94c5223a7
|
||||
Revises: c123dbf9c659
|
||||
Create Date: 2021-08-17 12:10:01.082632
|
||||
|
||||
"""
|
||||
import sqlalchemy as sa
|
||||
|
||||
from alembic import op
|
||||
from sqlalchemy import column, table
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "81d94c5223a7"
|
||||
down_revision = "c123dbf9c659"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
sp = table(
|
||||
"section_printers",
|
||||
column("id", postgresql.UUID(as_uuid=True)),
|
||||
)
|
||||
op.execute(sp.delete())
|
||||
|
||||
op.add_column("section_printers", sa.Column("sale_category_id", postgresql.UUID(as_uuid=True), nullable=True))
|
||||
op.drop_constraint("uq_section_printers_menu_category_id", "section_printers", type_="unique")
|
||||
op.create_unique_constraint(
|
||||
op.f("uq_section_printers_sale_category_id"), "section_printers", ["sale_category_id", "section_id"]
|
||||
)
|
||||
op.drop_constraint("fk_section_printers_menu_category_id_menu_categories", "section_printers", type_="foreignkey")
|
||||
op.create_foreign_key(
|
||||
op.f("fk_section_printers_sale_category_id_sale_categories"),
|
||||
"section_printers",
|
||||
"sale_categories",
|
||||
["sale_category_id"],
|
||||
["id"],
|
||||
)
|
||||
op.drop_column("section_printers", "menu_category_id")
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
sp = table(
|
||||
"section_printers",
|
||||
column("id", postgresql.UUID(as_uuid=True)),
|
||||
)
|
||||
op.execute(sp.delete())
|
||||
|
||||
op.add_column(
|
||||
"section_printers", sa.Column("menu_category_id", postgresql.UUID(), autoincrement=False, nullable=True)
|
||||
)
|
||||
op.drop_constraint(
|
||||
op.f("fk_section_printers_sale_category_id_sale_categories"), "section_printers", type_="foreignkey"
|
||||
)
|
||||
op.create_foreign_key(
|
||||
"fk_section_printers_menu_category_id_menu_categories",
|
||||
"section_printers",
|
||||
"menu_categories",
|
||||
["menu_category_id"],
|
||||
["id"],
|
||||
)
|
||||
op.drop_constraint(op.f("uq_section_printers_sale_category_id"), "section_printers", type_="unique")
|
||||
op.create_unique_constraint(
|
||||
"uq_section_printers_menu_category_id", "section_printers", ["menu_category_id", "section_id"]
|
||||
)
|
||||
op.drop_column("section_printers", "sale_category_id")
|
||||
# ### end Alembic commands ###
|
||||
Reference in New Issue
Block a user