From ccc39b951671accf29bcb9a59938413bfb6e4ad4 Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Sat, 1 Jul 2023 20:54:47 +0800 Subject: [PATCH] Move all old db patch files to `db/old_migrations/` --- db/old_migrations/README.md | 3 +++ db/{ => old_migrations}/patch-2fa-invalidate-used-token.sql | 0 db/{ => old_migrations}/patch-2fa.sql | 0 .../patch-add-clickable-status-page-link.sql | 0 db/{ => old_migrations}/patch-add-description-monitor.sql | 0 db/{ => old_migrations}/patch-add-docker-columns.sql | 0 db/{ => old_migrations}/patch-add-gamedig-monitor.sql | 0 .../patch-add-google-analytics-status-page-tag.sql | 0 db/{ => old_migrations}/patch-add-other-auth.sql | 0 db/{ => old_migrations}/patch-add-parent-monitor.sql | 0 db/{ => old_migrations}/patch-add-radius-monitor.sql | 0 db/{ => old_migrations}/patch-add-retry-interval-monitor.sql | 0 db/{ => old_migrations}/patch-add-sqlserver-monitor.sql | 0 db/{ => old_migrations}/patch-added-mqtt-monitor.sql | 0 db/{ => old_migrations}/patch-api-key-table.sql | 0 db/{ => old_migrations}/patch-group-table.sql | 0 db/{ => old_migrations}/patch-grpc-monitor.sql | 0 db/{ => old_migrations}/patch-http-body-encoding.sql | 0 .../patch-http-monitor-method-body-and-headers.sql | 0 db/{ => old_migrations}/patch-improve-performance.sql | 0 db/{ => old_migrations}/patch-incident-table.sql | 0 db/{ => old_migrations}/patch-maintenance-cron.sql | 0 db/{ => old_migrations}/patch-maintenance-table2.sql | 0 db/{ => old_migrations}/patch-monitor-add-resend-interval.sql | 0 db/{ => old_migrations}/patch-monitor-basic-auth.sql | 0 db/{ => old_migrations}/patch-monitor-expiry-notification.sql | 0 db/{ => old_migrations}/patch-monitor-push_token.sql | 0 db/{ => old_migrations}/patch-monitor-tls.sql | 0 db/{ => old_migrations}/patch-notification_sent_history.sql | 0 db/{ => old_migrations}/patch-ping-packet-size.sql | 0 db/{ => old_migrations}/patch-proxy.sql | 0 db/{ => old_migrations}/patch-setting-value-type.sql | 0 db/{ => old_migrations}/patch-status-page-footer-css.sql | 0 db/{ => old_migrations}/patch-status-page.sql | 0 db/{ => old_migrations}/patch1.sql | 0 db/{ => old_migrations}/patch10.sql | 0 db/{ => old_migrations}/patch2.sql | 0 db/{ => old_migrations}/patch3.sql | 0 db/{ => old_migrations}/patch4.sql | 0 db/{ => old_migrations}/patch5.sql | 0 db/{ => old_migrations}/patch6.sql | 0 db/{ => old_migrations}/patch7.sql | 0 db/{ => old_migrations}/patch8.sql | 0 db/{ => old_migrations}/patch9.sql | 0 docker/docker-compose-dev.yml | 1 + server/database.js | 4 ++-- src/lang/en.json | 2 +- 47 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 db/old_migrations/README.md rename db/{ => old_migrations}/patch-2fa-invalidate-used-token.sql (100%) rename db/{ => old_migrations}/patch-2fa.sql (100%) rename db/{ => old_migrations}/patch-add-clickable-status-page-link.sql (100%) rename db/{ => old_migrations}/patch-add-description-monitor.sql (100%) rename db/{ => old_migrations}/patch-add-docker-columns.sql (100%) rename db/{ => old_migrations}/patch-add-gamedig-monitor.sql (100%) rename db/{ => old_migrations}/patch-add-google-analytics-status-page-tag.sql (100%) rename db/{ => old_migrations}/patch-add-other-auth.sql (100%) rename db/{ => old_migrations}/patch-add-parent-monitor.sql (100%) rename db/{ => old_migrations}/patch-add-radius-monitor.sql (100%) rename db/{ => old_migrations}/patch-add-retry-interval-monitor.sql (100%) rename db/{ => old_migrations}/patch-add-sqlserver-monitor.sql (100%) rename db/{ => old_migrations}/patch-added-mqtt-monitor.sql (100%) rename db/{ => old_migrations}/patch-api-key-table.sql (100%) rename db/{ => old_migrations}/patch-group-table.sql (100%) rename db/{ => old_migrations}/patch-grpc-monitor.sql (100%) rename db/{ => old_migrations}/patch-http-body-encoding.sql (100%) rename db/{ => old_migrations}/patch-http-monitor-method-body-and-headers.sql (100%) rename db/{ => old_migrations}/patch-improve-performance.sql (100%) rename db/{ => old_migrations}/patch-incident-table.sql (100%) rename db/{ => old_migrations}/patch-maintenance-cron.sql (100%) rename db/{ => old_migrations}/patch-maintenance-table2.sql (100%) rename db/{ => old_migrations}/patch-monitor-add-resend-interval.sql (100%) rename db/{ => old_migrations}/patch-monitor-basic-auth.sql (100%) rename db/{ => old_migrations}/patch-monitor-expiry-notification.sql (100%) rename db/{ => old_migrations}/patch-monitor-push_token.sql (100%) rename db/{ => old_migrations}/patch-monitor-tls.sql (100%) rename db/{ => old_migrations}/patch-notification_sent_history.sql (100%) rename db/{ => old_migrations}/patch-ping-packet-size.sql (100%) rename db/{ => old_migrations}/patch-proxy.sql (100%) rename db/{ => old_migrations}/patch-setting-value-type.sql (100%) rename db/{ => old_migrations}/patch-status-page-footer-css.sql (100%) rename db/{ => old_migrations}/patch-status-page.sql (100%) rename db/{ => old_migrations}/patch1.sql (100%) rename db/{ => old_migrations}/patch10.sql (100%) rename db/{ => old_migrations}/patch2.sql (100%) rename db/{ => old_migrations}/patch3.sql (100%) rename db/{ => old_migrations}/patch4.sql (100%) rename db/{ => old_migrations}/patch5.sql (100%) rename db/{ => old_migrations}/patch6.sql (100%) rename db/{ => old_migrations}/patch7.sql (100%) rename db/{ => old_migrations}/patch8.sql (100%) rename db/{ => old_migrations}/patch9.sql (100%) diff --git a/db/old_migrations/README.md b/db/old_migrations/README.md new file mode 100644 index 000000000..3b2bd9640 --- /dev/null +++ b/db/old_migrations/README.md @@ -0,0 +1,3 @@ +# Don't create a new migration file here + +Please go to ./db/knex_migrations/README.md diff --git a/db/patch-2fa-invalidate-used-token.sql b/db/old_migrations/patch-2fa-invalidate-used-token.sql similarity index 100% rename from db/patch-2fa-invalidate-used-token.sql rename to db/old_migrations/patch-2fa-invalidate-used-token.sql diff --git a/db/patch-2fa.sql b/db/old_migrations/patch-2fa.sql similarity index 100% rename from db/patch-2fa.sql rename to db/old_migrations/patch-2fa.sql diff --git a/db/patch-add-clickable-status-page-link.sql b/db/old_migrations/patch-add-clickable-status-page-link.sql similarity index 100% rename from db/patch-add-clickable-status-page-link.sql rename to db/old_migrations/patch-add-clickable-status-page-link.sql diff --git a/db/patch-add-description-monitor.sql b/db/old_migrations/patch-add-description-monitor.sql similarity index 100% rename from db/patch-add-description-monitor.sql rename to db/old_migrations/patch-add-description-monitor.sql diff --git a/db/patch-add-docker-columns.sql b/db/old_migrations/patch-add-docker-columns.sql similarity index 100% rename from db/patch-add-docker-columns.sql rename to db/old_migrations/patch-add-docker-columns.sql diff --git a/db/patch-add-gamedig-monitor.sql b/db/old_migrations/patch-add-gamedig-monitor.sql similarity index 100% rename from db/patch-add-gamedig-monitor.sql rename to db/old_migrations/patch-add-gamedig-monitor.sql diff --git a/db/patch-add-google-analytics-status-page-tag.sql b/db/old_migrations/patch-add-google-analytics-status-page-tag.sql similarity index 100% rename from db/patch-add-google-analytics-status-page-tag.sql rename to db/old_migrations/patch-add-google-analytics-status-page-tag.sql diff --git a/db/patch-add-other-auth.sql b/db/old_migrations/patch-add-other-auth.sql similarity index 100% rename from db/patch-add-other-auth.sql rename to db/old_migrations/patch-add-other-auth.sql diff --git a/db/patch-add-parent-monitor.sql b/db/old_migrations/patch-add-parent-monitor.sql similarity index 100% rename from db/patch-add-parent-monitor.sql rename to db/old_migrations/patch-add-parent-monitor.sql diff --git a/db/patch-add-radius-monitor.sql b/db/old_migrations/patch-add-radius-monitor.sql similarity index 100% rename from db/patch-add-radius-monitor.sql rename to db/old_migrations/patch-add-radius-monitor.sql diff --git a/db/patch-add-retry-interval-monitor.sql b/db/old_migrations/patch-add-retry-interval-monitor.sql similarity index 100% rename from db/patch-add-retry-interval-monitor.sql rename to db/old_migrations/patch-add-retry-interval-monitor.sql diff --git a/db/patch-add-sqlserver-monitor.sql b/db/old_migrations/patch-add-sqlserver-monitor.sql similarity index 100% rename from db/patch-add-sqlserver-monitor.sql rename to db/old_migrations/patch-add-sqlserver-monitor.sql diff --git a/db/patch-added-mqtt-monitor.sql b/db/old_migrations/patch-added-mqtt-monitor.sql similarity index 100% rename from db/patch-added-mqtt-monitor.sql rename to db/old_migrations/patch-added-mqtt-monitor.sql diff --git a/db/patch-api-key-table.sql b/db/old_migrations/patch-api-key-table.sql similarity index 100% rename from db/patch-api-key-table.sql rename to db/old_migrations/patch-api-key-table.sql diff --git a/db/patch-group-table.sql b/db/old_migrations/patch-group-table.sql similarity index 100% rename from db/patch-group-table.sql rename to db/old_migrations/patch-group-table.sql diff --git a/db/patch-grpc-monitor.sql b/db/old_migrations/patch-grpc-monitor.sql similarity index 100% rename from db/patch-grpc-monitor.sql rename to db/old_migrations/patch-grpc-monitor.sql diff --git a/db/patch-http-body-encoding.sql b/db/old_migrations/patch-http-body-encoding.sql similarity index 100% rename from db/patch-http-body-encoding.sql rename to db/old_migrations/patch-http-body-encoding.sql diff --git a/db/patch-http-monitor-method-body-and-headers.sql b/db/old_migrations/patch-http-monitor-method-body-and-headers.sql similarity index 100% rename from db/patch-http-monitor-method-body-and-headers.sql rename to db/old_migrations/patch-http-monitor-method-body-and-headers.sql diff --git a/db/patch-improve-performance.sql b/db/old_migrations/patch-improve-performance.sql similarity index 100% rename from db/patch-improve-performance.sql rename to db/old_migrations/patch-improve-performance.sql diff --git a/db/patch-incident-table.sql b/db/old_migrations/patch-incident-table.sql similarity index 100% rename from db/patch-incident-table.sql rename to db/old_migrations/patch-incident-table.sql diff --git a/db/patch-maintenance-cron.sql b/db/old_migrations/patch-maintenance-cron.sql similarity index 100% rename from db/patch-maintenance-cron.sql rename to db/old_migrations/patch-maintenance-cron.sql diff --git a/db/patch-maintenance-table2.sql b/db/old_migrations/patch-maintenance-table2.sql similarity index 100% rename from db/patch-maintenance-table2.sql rename to db/old_migrations/patch-maintenance-table2.sql diff --git a/db/patch-monitor-add-resend-interval.sql b/db/old_migrations/patch-monitor-add-resend-interval.sql similarity index 100% rename from db/patch-monitor-add-resend-interval.sql rename to db/old_migrations/patch-monitor-add-resend-interval.sql diff --git a/db/patch-monitor-basic-auth.sql b/db/old_migrations/patch-monitor-basic-auth.sql similarity index 100% rename from db/patch-monitor-basic-auth.sql rename to db/old_migrations/patch-monitor-basic-auth.sql diff --git a/db/patch-monitor-expiry-notification.sql b/db/old_migrations/patch-monitor-expiry-notification.sql similarity index 100% rename from db/patch-monitor-expiry-notification.sql rename to db/old_migrations/patch-monitor-expiry-notification.sql diff --git a/db/patch-monitor-push_token.sql b/db/old_migrations/patch-monitor-push_token.sql similarity index 100% rename from db/patch-monitor-push_token.sql rename to db/old_migrations/patch-monitor-push_token.sql diff --git a/db/patch-monitor-tls.sql b/db/old_migrations/patch-monitor-tls.sql similarity index 100% rename from db/patch-monitor-tls.sql rename to db/old_migrations/patch-monitor-tls.sql diff --git a/db/patch-notification_sent_history.sql b/db/old_migrations/patch-notification_sent_history.sql similarity index 100% rename from db/patch-notification_sent_history.sql rename to db/old_migrations/patch-notification_sent_history.sql diff --git a/db/patch-ping-packet-size.sql b/db/old_migrations/patch-ping-packet-size.sql similarity index 100% rename from db/patch-ping-packet-size.sql rename to db/old_migrations/patch-ping-packet-size.sql diff --git a/db/patch-proxy.sql b/db/old_migrations/patch-proxy.sql similarity index 100% rename from db/patch-proxy.sql rename to db/old_migrations/patch-proxy.sql diff --git a/db/patch-setting-value-type.sql b/db/old_migrations/patch-setting-value-type.sql similarity index 100% rename from db/patch-setting-value-type.sql rename to db/old_migrations/patch-setting-value-type.sql diff --git a/db/patch-status-page-footer-css.sql b/db/old_migrations/patch-status-page-footer-css.sql similarity index 100% rename from db/patch-status-page-footer-css.sql rename to db/old_migrations/patch-status-page-footer-css.sql diff --git a/db/patch-status-page.sql b/db/old_migrations/patch-status-page.sql similarity index 100% rename from db/patch-status-page.sql rename to db/old_migrations/patch-status-page.sql diff --git a/db/patch1.sql b/db/old_migrations/patch1.sql similarity index 100% rename from db/patch1.sql rename to db/old_migrations/patch1.sql diff --git a/db/patch10.sql b/db/old_migrations/patch10.sql similarity index 100% rename from db/patch10.sql rename to db/old_migrations/patch10.sql diff --git a/db/patch2.sql b/db/old_migrations/patch2.sql similarity index 100% rename from db/patch2.sql rename to db/old_migrations/patch2.sql diff --git a/db/patch3.sql b/db/old_migrations/patch3.sql similarity index 100% rename from db/patch3.sql rename to db/old_migrations/patch3.sql diff --git a/db/patch4.sql b/db/old_migrations/patch4.sql similarity index 100% rename from db/patch4.sql rename to db/old_migrations/patch4.sql diff --git a/db/patch5.sql b/db/old_migrations/patch5.sql similarity index 100% rename from db/patch5.sql rename to db/old_migrations/patch5.sql diff --git a/db/patch6.sql b/db/old_migrations/patch6.sql similarity index 100% rename from db/patch6.sql rename to db/old_migrations/patch6.sql diff --git a/db/patch7.sql b/db/old_migrations/patch7.sql similarity index 100% rename from db/patch7.sql rename to db/old_migrations/patch7.sql diff --git a/db/patch8.sql b/db/old_migrations/patch8.sql similarity index 100% rename from db/patch8.sql rename to db/old_migrations/patch8.sql diff --git a/db/patch9.sql b/db/old_migrations/patch9.sql similarity index 100% rename from db/patch9.sql rename to db/old_migrations/patch9.sql diff --git a/docker/docker-compose-dev.yml b/docker/docker-compose-dev.yml index 6eeb91e65..c66b24b58 100644 --- a/docker/docker-compose-dev.yml +++ b/docker/docker-compose-dev.yml @@ -7,6 +7,7 @@ services: volumes: #- ./data:/app/data - ../server:/app/server + - ../db:/app/db ports: - "3001:3001" # : - "3307:3306" diff --git a/server/database.js b/server/database.js index 2e8a01eb8..73264f4b6 100644 --- a/server/database.js +++ b/server/database.js @@ -356,7 +356,7 @@ class Database { // Try catch anything here try { for (let i = version + 1; i <= this.latestVersion; i++) { - const sqlFile = `./db/patch${i}.sql`; + const sqlFile = `./db/old_migrations/patch${i}.sql`; log.info("db", `Patching ${sqlFile}`); await Database.importSQLFile(sqlFile); log.info("db", `Patched ${sqlFile}`); @@ -515,7 +515,7 @@ class Database { log.info("db", sqlFilename + " is patching"); this.patched = true; - await this.importSQLFile("./db/" + sqlFilename); + await this.importSQLFile("./db/old_migrations/" + sqlFilename); databasePatchedFiles[sqlFilename] = true; log.info("db", sqlFilename + " was patched successfully"); diff --git a/src/lang/en.json b/src/lang/en.json index 79fe8da72..e78878d14 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -3,7 +3,7 @@ "setupDatabaseChooseDatabase": "Which database do you want to use?", "setupDatabaseEmbeddedMariaDB": "You don't need to set anything. This docker image have embedded and configured a MariaDB for you automatically. Uptime Kuma will connect to this database via unix socket.", "setupDatabaseMariaDB": "Connect to an external MariaDB database. You need to set the database connection information.", - "setupDatabaseSQLite": "A simple database file. It is recommended for small scale deployment. Before 2.0.0, Uptime Kuma used SQLite by default.", + "setupDatabaseSQLite": "A simple database file, recommended for small-scale deployments. Prior to v2.0.0, Uptime Kuma used SQLite as the default database.", "dbName": "Database Name", "Settings": "Settings", "Dashboard": "Dashboard",