refactor(modules): master/drop/migrations schema layout + harden install

Mirror core's DB layout at the module level: one master database.sql (full
current schema), one database_drop.sql (teardown), and forward-only
migrations/<semver>.sql deltas. ModuleMigrator gains install()/uninstall();
up() reads migrations/*.sql; down() removed.

- watch: database.sql (delete_missing folded into watch_folders),
  database_drop.sql, migrations/1.0.1.sql; drop 1.0.0.up/down.sql;
  getVersion() -> 1.0.1 (matches module.json).
- Move core migration 004_add_watch_delete_missing.sql into the watch module.
- installModule no longer wraps the DDL migration in a transaction: MySQL/MariaDB
  implicitly commit DDL, so the wrapping rollback() only masked the real SQL error.
- syncBundledModules retries a previously-failed install (skips only admin-disabled)
  so `console.php status` self-heals.
This commit is contained in:
Divarion-D
2026-07-02 21:28:33 +03:00
parent b2e61c7d79
commit 58656fa396
8 changed files with 123 additions and 88 deletions
+7
View File
@@ -0,0 +1,7 @@
-- watch module — teardown (single deletion file)
-- Drops every table the module owns. Runs on uninstall. plex is uninstalled
-- first (it depends on watch), so its data is already gone by the time these run.
DROP TABLE IF EXISTS `watch_refresh`;
DROP TABLE IF EXISTS `watch_logs`;
DROP TABLE IF EXISTS `watch_folders`;
DROP TABLE IF EXISTS `watch_categories`;