changeset 3743:54c249ec35ce

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
author Goffi <goffi@goffi.org>
date Tue, 22 Mar 2022 17:00:42 +0100
parents bf0505d41c09
children 658ddbabaf36
files sat/memory/migration/env.py
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/sat/memory/migration/env.py	Tue Mar 22 17:00:42 2022 +0100
+++ b/sat/memory/migration/env.py	Tue Mar 22 17:00:42 2022 +0100
@@ -50,11 +50,19 @@
         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():