tweaks
This commit is contained in:
@@ -25,6 +25,7 @@ TENANT_TABLES = {
|
||||
"raw_material_price_versions": None,
|
||||
"mixes": None,
|
||||
"mix_ingredients": None,
|
||||
"product_ingredients": None,
|
||||
"mix_calculator_sessions": None,
|
||||
"mix_calculator_session_lines": None,
|
||||
"products": None,
|
||||
@@ -33,6 +34,8 @@ TENANT_TABLES = {
|
||||
"process_cost_rules": None,
|
||||
"packaging_cost_rules": None,
|
||||
"freight_cost_rules": None,
|
||||
"throughput_products": None,
|
||||
"production_throughput_entries": None,
|
||||
}
|
||||
|
||||
|
||||
@@ -99,6 +102,7 @@ def ensure_tenant_columns(engine: Engine) -> tuple[str, ...]:
|
||||
_LEGACY_COLUMN_PATCHES: tuple[tuple[str, str, str], ...] = (
|
||||
("users", "password_hash", "VARCHAR(255)"),
|
||||
("products", "visible", "BOOLEAN NOT NULL DEFAULT TRUE"),
|
||||
("throughput_products", "is_stock_item", "BOOLEAN NOT NULL DEFAULT TRUE"),
|
||||
)
|
||||
|
||||
|
||||
@@ -243,6 +247,20 @@ def sync_tenant_ids(engine: Engine) -> dict[str, int]:
|
||||
"""
|
||||
),
|
||||
),
|
||||
(
|
||||
"product_ingredients",
|
||||
text(
|
||||
"""
|
||||
UPDATE product_ingredients
|
||||
SET tenant_id = (
|
||||
SELECT products.tenant_id
|
||||
FROM products
|
||||
WHERE products.id = product_ingredients.product_id
|
||||
)
|
||||
WHERE tenant_id IS NULL OR tenant_id = '' OR tenant_id = 'default'
|
||||
"""
|
||||
),
|
||||
),
|
||||
(
|
||||
"products",
|
||||
text(
|
||||
|
||||
Reference in New Issue
Block a user