Saved layouts feature
This commit is contained in:
@@ -188,20 +188,22 @@ def test_migration_16_raw_sql_path_applies_to_an_existing_pre_widget_database(db
|
||||
migrate."""
|
||||
with db_module.engine.begin() as conn:
|
||||
# static_widget_configs/text_widget_configs are migration 20/21
|
||||
# tables (also post-16, like the rest of this list) -- dropped
|
||||
# here too so a real version-15 database is what's actually
|
||||
# being simulated, not "version 15 plus two tables that
|
||||
# wouldn't exist yet". Harmless to omit as long as no migration
|
||||
# after the one that creates a table also ALTERs it (that's
|
||||
# what let static_widget_configs go unlisted safely so far --
|
||||
# Base.metadata.create_all is idempotent against an
|
||||
# already-present table with no later ALTER to collide with),
|
||||
# but text_widget_configs' migration 22 ALTER makes the gap a
|
||||
# real "table already exists"/"duplicate column" collision
|
||||
# instead of a silent no-op.
|
||||
# tables, and saved_layouts/saved_layout_widgets/saved_layout_
|
||||
# sources/saved_layout_button_actions are migration 23's (all
|
||||
# post-16, like the rest of this list) -- dropped here too so a
|
||||
# real version-15 database is what's actually being simulated,
|
||||
# not "version 15 plus tables that wouldn't exist yet". Harmless
|
||||
# to omit as long as no migration after the one that creates a
|
||||
# table also ALTERs it (that's what let static_widget_configs go
|
||||
# unlisted safely so far -- Base.metadata.create_all is
|
||||
# idempotent against an already-present table with no later
|
||||
# ALTER to collide with), but text_widget_configs' migration 22
|
||||
# ALTER makes the gap a real "table already exists"/"duplicate
|
||||
# column" collision instead of a silent no-op.
|
||||
for table in ("frame_button_actions", "whiteboard_widget_configs", "task_widget_configs", "frame_task_lists",
|
||||
"calendar_widget_configs", "photo_widget_configs", "static_widget_configs",
|
||||
"text_widget_configs", "widgets"):
|
||||
"text_widget_configs", "saved_layout_button_actions", "saved_layout_sources",
|
||||
"saved_layout_widgets", "saved_layouts", "widgets"):
|
||||
conn.execute(text(f"DROP TABLE {table}"))
|
||||
conn.execute(text("DROP TABLE frame_calendars"))
|
||||
conn.execute(text(
|
||||
@@ -268,18 +270,22 @@ def test_migration_17_and_18_extract_tasks_into_a_standalone_multi_list_widget(d
|
||||
tasks_* columns and TaskWidgetConfig no longer having user_id/
|
||||
calendar_key columns either."""
|
||||
with db_module.engine.begin() as conn:
|
||||
# static_widget_configs/text_widget_configs dropped too -- see
|
||||
# the comment on the identical setup in
|
||||
# static_widget_configs/text_widget_configs/saved_layout_* dropped
|
||||
# too -- see the comment on the identical setup in
|
||||
# test_migration_16_raw_sql_path_applies_to_an_existing_pre_widget_database above (migrations
|
||||
# 20/21's raw CREATE TABLE collides with an already-present table
|
||||
# otherwise, since this test replays 17 through 22 and neither
|
||||
# table would really exist yet at a genuine pre-migration-17
|
||||
# 20/21/23's raw CREATE TABLE collides with an already-present table
|
||||
# otherwise, since this test replays 17 through 23 and none of
|
||||
# these tables would really exist yet at a genuine pre-migration-17
|
||||
# schema_version).
|
||||
conn.execute(text("DROP TABLE task_widget_configs"))
|
||||
conn.execute(text("DROP TABLE frame_task_lists"))
|
||||
conn.execute(text("DROP TABLE calendar_widget_configs"))
|
||||
conn.execute(text("DROP TABLE static_widget_configs"))
|
||||
conn.execute(text("DROP TABLE text_widget_configs"))
|
||||
conn.execute(text("DROP TABLE saved_layout_button_actions"))
|
||||
conn.execute(text("DROP TABLE saved_layout_sources"))
|
||||
conn.execute(text("DROP TABLE saved_layout_widgets"))
|
||||
conn.execute(text("DROP TABLE saved_layouts"))
|
||||
conn.execute(text(
|
||||
"CREATE TABLE calendar_widget_configs ("
|
||||
"widget_id INTEGER PRIMARY KEY REFERENCES widgets(id) ON DELETE CASCADE, "
|
||||
@@ -374,12 +380,13 @@ def test_frame_calendars_rekey_attaches_existing_rows_to_their_calendar_widget(d
|
||||
the widget backfill, not as a numbered migration racing ahead of
|
||||
it (see _ensure_frame_calendars_rekeyed's own docstring)."""
|
||||
with db_module.engine.begin() as conn:
|
||||
# static_widget_configs/text_widget_configs dropped too -- see
|
||||
# the comment on the identical setup in
|
||||
# static_widget_configs/text_widget_configs/saved_layout_* dropped
|
||||
# too -- see the comment on the identical setup in
|
||||
# test_migration_16_raw_sql_path_applies_to_an_existing_pre_widget_database above.
|
||||
for table in ("frame_button_actions", "whiteboard_widget_configs", "task_widget_configs", "frame_task_lists",
|
||||
"calendar_widget_configs", "photo_widget_configs", "static_widget_configs",
|
||||
"text_widget_configs", "widgets"):
|
||||
"text_widget_configs", "saved_layout_button_actions", "saved_layout_sources",
|
||||
"saved_layout_widgets", "saved_layouts", "widgets"):
|
||||
conn.execute(text(f"DROP TABLE {table}"))
|
||||
conn.execute(text("DROP TABLE frame_calendars"))
|
||||
conn.execute(text(
|
||||
|
||||
Reference in New Issue
Block a user