Skip to content

Create the tables on activation only when they are missing - #5

Merged
anoziere merged 1 commit into
mainfrom
fix/keep-data-on-reactivation
Oct 21, 2026
Merged

anoziere merged 1 commit into
mainfrom
fix/keep-data-on-reactivation

Conversation

@julescournut

Copy link
Copy Markdown
Contributor

preActivation() ran Config/TheliaMain.sql whenever the is_initialized value of the module configuration was missing. The script starts with DROP TABLE, so on a database that has the tables but not the flag (a test database built by bin/test-prepare, a database restored without module_config, a lost configuration), deactivating and reactivating the module deleted every short code.

The hook now asks the database instead: the script runs only when the short_code table does not exist. The flag is no longer read or written. CustomFrontMenu 2.0.0 does the same.

Tests/Integration/ActivationTest.php writes a row, removes the flag, activates the module and checks the row is still there; it fails without the fix. A second test drops the tables of the module and checks that activation creates them all again. Reactivating the module from the command line on a demo shop without the flag kept its short codes.

The module is bumped to 3.0.3.

@anoziere
anoziere merged commit ac504ea into main Oct 21, 2026
5 checks passed
@anoziere
anoziere deleted the fix/keep-data-on-reactivation branch October 21, 2026 06:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants