summaryrefslogtreecommitdiff
path: root/packages/backend/scripts
diff options
context:
space:
mode:
authoranatawa12 <anatawa12@icloud.com>2025-07-16 15:49:05 +0900
committerGitHub <noreply@github.com>2025-07-16 15:49:05 +0900
commit6f6fdfe28e3638e09ee1452fd2a8bb4271e1d0ce (patch)
treeee61252eaa0aa57ec4fc7b380b6637549c624af0 /packages/backend/scripts
parentenhance(backend): usernameに対してもprohibitedWordsForNameOfUserを適... (diff)
downloadmisskey-6f6fdfe28e3638e09ee1452fd2a8bb4271e1d0ce.tar.gz
misskey-6f6fdfe28e3638e09ee1452fd2a8bb4271e1d0ce.tar.bz2
misskey-6f6fdfe28e3638e09ee1452fd2a8bb4271e1d0ce.zip
Migration cleanup (#16288)
* chore: apply several @Index and @ManyToOne to match actual migration code * chore: several decorator updates with typeorm bug workaround with patches * feat: add final cleanup migration * dev: add .editorconfig settings for generated migrations * chore: update dockerfile to build package with patches * chore: update federation test compose to include patches * chore: revert few dependency update * chore: don't check disableRegistration on test env * test: add test for checking migration script * chore: set proxyRemoteFiles true in test config * chore: enter invitation code in signup test * fix: register send button is not disabled when invitationCode is not input
Diffstat (limited to 'packages/backend/scripts')
-rw-r--r--packages/backend/scripts/check_migrations_clean.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/packages/backend/scripts/check_migrations_clean.js b/packages/backend/scripts/check_migrations_clean.js
new file mode 100644
index 0000000000..ce67b1cd81
--- /dev/null
+++ b/packages/backend/scripts/check_migrations_clean.js
@@ -0,0 +1,26 @@
+/*
+ * SPDX-FileCopyrightText: syuilo and misskey-project
+ * SPDX-License-Identifier: AGPL-3.0-only
+ */
+
+// This script checks if the database migrations has been generated correctly.
+
+import dataSource from '../ormconfig.js';
+
+await dataSource.initialize();
+
+const sqlInMemory = await dataSource.driver.createSchemaBuilder().log();
+
+if (sqlInMemory.upQueries.length > 0 || sqlInMemory.downQueries.length > 0) {
+ console.error('There are several pending migrations. Please make sure you have generated the migrations correctly, or configured entities class correctly.');
+ for (const query of sqlInMemory.upQueries) {
+ console.error(`- ${query.query}`);
+ }
+ for (const query of sqlInMemory.downQueries) {
+ console.error(`- ${query.query}`);
+ }
+ process.exit(1);
+} else {
+ console.log('All migrations are clean.');
+ process.exit(0);
+}