From f90d76aa18aedc9300cb5286345b69786d4d58cf Mon Sep 17 00:00:00 2001 From: Goffi Date: Tue, 22 Mar 2022 17:00:42 +0100 Subject: [PATCH] core (memory/migration): ignore FTS table when autogenerating script for migration: SQLite Full-Text Search stable are not associated to Python object and can't be detected by Alembic. To avoid the generation of unwanted drop commands, they are now ignored when autogenerating migration scripts. rel 364 --- sat/memory/migration/env.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sat/memory/migration/env.py b/sat/memory/migration/env.py index ef5a0942..01dcd958 100644 --- a/sat/memory/migration/env.py +++ b/sat/memory/migration/env.py @@ -50,11 +50,19 @@ def run_migrations_offline(): context.run_migrations() +def include_name(name, type_, parent_names): + if type_ == "table": + if name.startswith("pubsub_items_fts"): + return False + return True + + def do_run_migrations(connection): context.configure( connection=connection, target_metadata=target_metadata, - render_as_batch=True + render_as_batch=True, + include_name=include_name ) with context.begin_transaction():