Drop migration of "paid" to non-nullable

The DB contains NULLs here, and I'll just leave them be.
This commit is contained in:
Midgard 2020-01-26 19:48:31 +01:00
parent 285d4223e2
commit 7e476c39dc
Signed by: midgard
GPG key ID: 511C112F1331BBB4
3 changed files with 3 additions and 5 deletions

View file

@ -2,9 +2,9 @@
# config # config
class Configuration(): class Configuration:
"Haldis configuration object" "Haldis configuration object"
# pylint: disable=R0903 # pylint: disable=too-few-public-methods
SQLALCHEMY_DATABASE_URI = "sqlite:///haldis.db" SQLALCHEMY_DATABASE_URI = "sqlite:///haldis.db"
SQLALCHEMY_TRACK_MODIFICATIONS = False SQLALCHEMY_TRACK_MODIFICATIONS = False
DEBUG = True DEBUG = True

View file

@ -65,7 +65,6 @@ def upgrade():
sa.PrimaryKeyConstraint("id") sa.PrimaryKeyConstraint("id")
) )
op.add_column("order_item", sa.Column("hlds_data_version", sa.String(length=40), nullable=True)) op.add_column("order_item", sa.Column("hlds_data_version", sa.String(length=40), nullable=True))
op.alter_column("order_item", "paid", existing_type=sa.BOOLEAN(), nullable=False)
op.alter_column("order", "courrier_id", new_column_name="courier_id") op.alter_column("order", "courrier_id", new_column_name="courier_id")
op.alter_column("order_item", "extra", new_column_name="comment", op.alter_column("order_item", "extra", new_column_name="comment",
existing_type=sa.String(254), type_=sa.Text()) existing_type=sa.String(254), type_=sa.Text())
@ -140,7 +139,6 @@ def upgrade():
def downgrade(): def downgrade():
"Don't use this. It will cripple the data." "Don't use this. It will cripple the data."
op.alter_column("order_item", "paid", existing_type=sa.Boolean(), nullable=True)
op.alter_column("order", "courier_id", new_column_name="courrier_id") op.alter_column("order", "courier_id", new_column_name="courrier_id")
op.alter_column("order_item", "comment", new_column_name="extra", op.alter_column("order_item", "comment", new_column_name="extra",
existing_type=sa.Text(), type_=sa.String(254)) existing_type=sa.Text(), type_=sa.String(254))

View file

@ -16,7 +16,7 @@ class OrderItem(db.Model):
dish_name = db.Column(db.String(120), nullable=True) dish_name = db.Column(db.String(120), nullable=True)
price = db.Column(db.Integer, nullable=False) price = db.Column(db.Integer, nullable=False)
paid = db.Column( paid = db.Column(
db.Boolean, default=False, nullable=False db.Boolean, default=False, nullable=True
) )
comment = db.Column(db.Text(), nullable=True) comment = db.Column(db.Text(), nullable=True)
hlds_data_version = db.Column(db.String(40), nullable=True) hlds_data_version = db.Column(db.String(40), nullable=True)