Add shopping entry notes
This commit is contained in:
+11
@@ -487,6 +487,7 @@ def bootstrap_legacy_schema(database: sqlite3.Connection) -> None:
|
||||
add_column_if_missing(database, "shopping_entries", "household_id INTEGER")
|
||||
add_column_if_missing(database, "shopping_entries", "owner_user_id INTEGER")
|
||||
add_column_if_missing(database, "shopping_entries", "visibility TEXT NOT NULL DEFAULT 'shared'")
|
||||
add_column_if_missing(database, "shopping_entries", "shopping_note TEXT NOT NULL DEFAULT ''")
|
||||
add_column_if_missing(database, "shopping_entries", "needed_for_date TEXT")
|
||||
add_column_if_missing(database, "shopping_entries", "needed_for_daypart_id INTEGER")
|
||||
|
||||
@@ -740,6 +741,7 @@ def ensure_schema_upgrades(database: sqlite3.Connection) -> None:
|
||||
add_column_if_missing(database, "items", "is_quick_added INTEGER NOT NULL DEFAULT 0")
|
||||
add_column_if_missing(database, "shopping_entries", "needed_for_date TEXT")
|
||||
add_column_if_missing(database, "shopping_entries", "needed_for_daypart_id INTEGER")
|
||||
add_column_if_missing(database, "shopping_entries", "shopping_note TEXT NOT NULL DEFAULT ''")
|
||||
add_column_if_missing(database, "user_settings", "suggestion_style TEXT NOT NULL DEFAULT 'balanced'")
|
||||
add_column_if_missing(database, "user_settings", "energy_preference TEXT NOT NULL DEFAULT 'neutral'")
|
||||
add_column_if_missing(database, "user_settings", "protein_preference TEXT NOT NULL DEFAULT 'mixed'")
|
||||
@@ -803,6 +805,7 @@ def ensure_schema_upgrades(database: sqlite3.Connection) -> None:
|
||||
database.execute("UPDATE items SET meal_tags = '' WHERE meal_tags IS NULL")
|
||||
database.execute("UPDATE items SET is_archived = 0 WHERE is_archived IS NULL")
|
||||
database.execute("UPDATE items SET is_quick_added = 0 WHERE is_quick_added IS NULL")
|
||||
database.execute("UPDATE shopping_entries SET shopping_note = '' WHERE shopping_note IS NULL")
|
||||
database.execute("UPDATE user_settings SET suggestion_style = 'balanced' WHERE suggestion_style IS NULL OR suggestion_style = ''")
|
||||
database.execute("UPDATE user_settings SET energy_preference = 'neutral' WHERE energy_preference IS NULL OR energy_preference = ''")
|
||||
database.execute("UPDATE user_settings SET protein_preference = 'mixed' WHERE protein_preference IS NULL OR protein_preference = ''")
|
||||
@@ -848,6 +851,14 @@ def ensure_schema_upgrades(database: sqlite3.Connection) -> None:
|
||||
ON shopping_entries (household_id, visibility, is_checked)
|
||||
"""
|
||||
)
|
||||
database.execute("DROP INDEX IF EXISTS idx_shopping_entries_open_item")
|
||||
database.execute(
|
||||
"""
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS idx_shopping_entries_open_item
|
||||
ON shopping_entries (item_id, COALESCE(shopping_note, ''))
|
||||
WHERE is_checked = 0
|
||||
"""
|
||||
)
|
||||
database.execute(
|
||||
"""
|
||||
CREATE INDEX IF NOT EXISTS idx_shopping_needs_household_activation
|
||||
|
||||
Reference in New Issue
Block a user