summaryrefslogtreecommitdiff
path: root/packages/backend/migration
diff options
context:
space:
mode:
Diffstat (limited to 'packages/backend/migration')
-rw-r--r--packages/backend/migration/1745378064470-composite-note-index.js8
-rw-r--r--packages/backend/migration/1746949539915-migrateSomeConfigFileSettingsToMeta.js8
-rw-r--r--packages/backend/migration/js/migration-config.js31
3 files changed, 7 insertions, 40 deletions
diff --git a/packages/backend/migration/1745378064470-composite-note-index.js b/packages/backend/migration/1745378064470-composite-note-index.js
index 12108a6b3c..576bf7d19a 100644
--- a/packages/backend/migration/1745378064470-composite-note-index.js
+++ b/packages/backend/migration/1745378064470-composite-note-index.js
@@ -3,14 +3,14 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
-import { isConcurrentIndexMigrationEnabled } from "./js/migration-config.js";
+const isConcurrentIndexMigrationEnabled = process.env.MISSKEY_MIGRATION_CREATE_INDEX_CONCURRENTLY === '1';
export class CompositeNoteIndex1745378064470 {
name = 'CompositeNoteIndex1745378064470';
- transaction = isConcurrentIndexMigrationEnabled() ? false : undefined;
+ transaction = isConcurrentIndexMigrationEnabled ? false : undefined;
async up(queryRunner) {
- const concurrently = isConcurrentIndexMigrationEnabled();
+ const concurrently = isConcurrentIndexMigrationEnabled;
if (concurrently) {
const hasValidIndex = await queryRunner.query(`SELECT indisvalid FROM pg_index INNER JOIN pg_class ON pg_index.indexrelid = pg_class.oid WHERE pg_class.relname = 'IDX_724b311e6f883751f261ebe378'`);
@@ -29,7 +29,7 @@ export class CompositeNoteIndex1745378064470 {
}
async down(queryRunner) {
- const mayConcurrently = isConcurrentIndexMigrationEnabled() ? 'CONCURRENTLY' : '';
+ const mayConcurrently = isConcurrentIndexMigrationEnabled ? 'CONCURRENTLY' : '';
await queryRunner.query(`DROP INDEX IF EXISTS "IDX_724b311e6f883751f261ebe378"`);
await queryRunner.query(`CREATE INDEX ${mayConcurrently} "IDX_5b87d9d19127bd5d92026017a7" ON "note" ("userId")`);
}
diff --git a/packages/backend/migration/1746949539915-migrateSomeConfigFileSettingsToMeta.js b/packages/backend/migration/1746949539915-migrateSomeConfigFileSettingsToMeta.js
index 3243f43b91..cb8bb33459 100644
--- a/packages/backend/migration/1746949539915-migrateSomeConfigFileSettingsToMeta.js
+++ b/packages/backend/migration/1746949539915-migrateSomeConfigFileSettingsToMeta.js
@@ -3,17 +3,15 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
-import {loadConfig} from "./js/migration-config.js";
export class MigrateSomeConfigFileSettingsToMeta1746949539915 {
name = 'MigrateSomeConfigFileSettingsToMeta1746949539915'
async up(queryRunner) {
- const config = loadConfig();
// $1 cannot be used in ALTER TABLE queries
- await queryRunner.query(`ALTER TABLE "meta" ADD "proxyRemoteFiles" boolean NOT NULL DEFAULT ${config.proxyRemoteFiles}`);
- await queryRunner.query(`ALTER TABLE "meta" ADD "signToActivityPubGet" boolean NOT NULL DEFAULT ${config.signToActivityPubGet}`);
- await queryRunner.query(`ALTER TABLE "meta" ADD "allowExternalApRedirect" boolean NOT NULL DEFAULT ${!config.disallowExternalApRedirect}`);
+ await queryRunner.query(`ALTER TABLE "meta" ADD "proxyRemoteFiles" boolean NOT NULL DEFAULT TRUE`);
+ await queryRunner.query(`ALTER TABLE "meta" ADD "signToActivityPubGet" boolean NOT NULL DEFAULT TRUE`);
+ await queryRunner.query(`ALTER TABLE "meta" ADD "allowExternalApRedirect" boolean NOT NULL DEFAULT TRUE`);
}
async down(queryRunner) {
diff --git a/packages/backend/migration/js/migration-config.js b/packages/backend/migration/js/migration-config.js
deleted file mode 100644
index 853735661b..0000000000
--- a/packages/backend/migration/js/migration-config.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * SPDX-FileCopyrightText: syuilo and misskey-project
- * SPDX-License-Identifier: AGPL-3.0-only
- */
-
-import { path as configYamlPath } from '../../built/config.js';
-import * as yaml from 'js-yaml';
-import fs from "node:fs";
-
-export function isConcurrentIndexMigrationEnabled() {
- return process.env.MISSKEY_MIGRATION_CREATE_INDEX_CONCURRENTLY === '1';
-}
-
-let loadedConfigCache = undefined;
-
-function loadConfigInternal() {
- const config = yaml.load(fs.readFileSync(configYamlPath, 'utf-8'));
-
- return {
- disallowExternalApRedirect: Boolean(config.disallowExternalApRedirect ?? false),
- proxyRemoteFiles: Boolean(config.proxyRemoteFiles ?? false),
- signToActivityPubGet: Boolean(config.signToActivityPubGet ?? true),
- }
-}
-
-export function loadConfig() {
- if (loadedConfigCache === undefined) {
- loadedConfigCache = loadConfigInternal();
- }
- return loadedConfigCache;
-}