diff --git a/packages/backend/migration/1697430068149-DefaultWithReplies.js b/packages/backend/migration/1697430068149-DefaultWithReplies.js new file mode 100644 index 000000000000..e93e55a93b5b --- /dev/null +++ b/packages/backend/migration/1697430068149-DefaultWithReplies.js @@ -0,0 +1,18 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +export class DefaultWithReplies1697430068149 { + name = 'DefaultWithReplies1697430068149' + + async up(queryRunner) { + await queryRunner.query(`ALTER TABLE "user" ADD "defaultWithReplies" boolean NOT NULL DEFAULT false`); + await queryRunner.query(`COMMENT ON COLUMN "user"."defaultWithReplies" IS 'Default value of withReplies for newly followed users'`); + } + + async down(queryRunner) { + await queryRunner.query(`COMMENT ON COLUMN "user"."defaultWithReplies" IS 'Default value of withReplies for newly followed users'`); + await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "defaultWithReplies"`); + } +} diff --git a/packages/backend/src/models/User.ts b/packages/backend/src/models/User.ts index 796d7c8356d7..a767302265ed 100644 --- a/packages/backend/src/models/User.ts +++ b/packages/backend/src/models/User.ts @@ -243,6 +243,12 @@ export class MiUser { }) public token: string | null; + @Column('boolean', { + default: false, + comment: 'Default value of withReplies for newly followed users', + }) + public defaultWithReplies: boolean; + constructor(data: Partial) { if (data == null) return;