From ed62c42db1763d7c2558e151a7538b9bcbe81932 Mon Sep 17 00:00:00 2001 From: earthcomfy Date: Tue, 18 Feb 2025 08:37:18 +0300 Subject: [PATCH 1/2] fix: add migration to remove old ckeditor table --- README.rst | 2 +- .../0004_remove_old_ckeditor_table.py | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 djangocms_text/migrations/0004_remove_old_ckeditor_table.py diff --git a/README.rst b/README.rst index 149cac6a..acd6207a 100644 --- a/README.rst +++ b/README.rst @@ -59,7 +59,7 @@ Upgrading from djangocms-text-ckeditor -------------------------------------- djangocms-text's migrations automatically migrate existing text plugins -from djangocms-text-ckeditor. All you have to do is: +from djangocms-text-ckeditor and clean up old tables. All you have to do is: * uninstall ``djangocms-text-ckeditor`` * remove ``djangocms_text_ckeditor`` from ``INSTALLED_APPS`` diff --git a/djangocms_text/migrations/0004_remove_old_ckeditor_table.py b/djangocms_text/migrations/0004_remove_old_ckeditor_table.py new file mode 100644 index 00000000..83a9e228 --- /dev/null +++ b/djangocms_text/migrations/0004_remove_old_ckeditor_table.py @@ -0,0 +1,23 @@ +from django.db import migrations + + +def drop_table_if_exists(apps, schema_editor): + table_name = "djangocms_text_ckeditor_text" + if table_name in schema_editor.connection.introspection.table_names(): + if schema_editor.connection.vendor == "postgresql": + schema_editor.execute("DROP TABLE IF EXISTS djangocms_text_ckeditor_text CASCADE;") + else: + schema_editor.execute("DROP TABLE IF EXISTS djangocms_text_ckeditor_text;") + + +class Migration(migrations.Migration): + dependencies = [ + ("djangocms_text", "0003_auto_20240702_1409"), + ] + + operations = [ + migrations.RunPython( + code=drop_table_if_exists, + reverse_code=migrations.RunPython.noop, + ), + ] From 48014acf33cdaf11ab107d38dfb0ec9cbefda163 Mon Sep 17 00:00:00 2001 From: earthcomfy Date: Tue, 18 Feb 2025 08:42:11 +0300 Subject: [PATCH 2/2] chore: add comma in readme for better readability --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index acd6207a..6447daaa 100644 --- a/README.rst +++ b/README.rst @@ -59,7 +59,7 @@ Upgrading from djangocms-text-ckeditor -------------------------------------- djangocms-text's migrations automatically migrate existing text plugins -from djangocms-text-ckeditor and clean up old tables. All you have to do is: +from djangocms-text-ckeditor, and clean up old tables. All you have to do is: * uninstall ``djangocms-text-ckeditor`` * remove ``djangocms_text_ckeditor`` from ``INSTALLED_APPS``