summaryrefslogtreecommitdiff
path: root/packages/backend/migration
diff options
context:
space:
mode:
authorsyuilo <4439005+syuilo@users.noreply.github.com>2025-12-04 16:49:25 +0900
committerGitHub <noreply@github.com>2025-12-04 16:49:25 +0900
commit24bd1509677023ddd8a749bb7fbfe876c7627b48 (patch)
treec3c65a5cf9091e434ad3ba83b087ffd952728caf /packages/backend/migration
parentfix(frontend): stacking router viewで連続して戻る操作を行うと何... (diff)
downloadmisskey-24bd1509677023ddd8a749bb7fbfe876c7627b48.tar.gz
misskey-24bd1509677023ddd8a749bb7fbfe876c7627b48.tar.bz2
misskey-24bd1509677023ddd8a749bb7fbfe876c7627b48.zip
refactor(backend): 変換後.config.jsonに統一するように+修正など (#16929)
* wip * Update config.ts * wip * convertは元ファイルを変更するようなニュアンスを若干感じるのでcompileに改名 * wip * Update package.json * Revert "Update package.json" This reverts commit e5c28023168f4631dc6b36a14b35cfddbad1fac0. * wip * wip * 謎 * clean up * wip * wip * Revert "wip" This reverts commit 3aa25ac7cf337d57412308e63d8f54e2536b0f7f. * wip * wip * Update dummy.yml * wip * Update compile_config.js * Update compile_config.js * wip * Revert "wip" This reverts commit fd78e097c65f747962e7a411938a0e67538ed347. * Update dummy.yml * Update compile_config.js
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;
-}