diff --git a/CHANGELOG.md b/CHANGELOG.md index f6d782c51909159bd7ddfd269e9a04049c376ee9..2ce3065a10dbed2427e176275937471291c54338 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,13 @@ --> +## 12.x.x (unreleased) + +### Improvements + +### Bugfixes +- ãƒãƒ£ãƒ³ãƒãƒ«ã‚’作æˆã—ã¦ã„ã‚‹ã¨ã‚¢ã‚«ã‚¦ãƒ³ãƒˆã‚’削除ã§ããªã„ã®ã‚’ä¿®æ£ + ## 12.88.0 (2021/08/17) ### Features diff --git a/migration/1629288472000-fix-channel-userId.ts b/migration/1629288472000-fix-channel-userId.ts new file mode 100644 index 0000000000000000000000000000000000000000..cd8f81bb01514992ffa1b0087550c35ff6ab8f34 --- /dev/null +++ b/migration/1629288472000-fix-channel-userId.ts @@ -0,0 +1,14 @@ +import {MigrationInterface, QueryRunner} from "typeorm"; + +export class fixChannelUserId1629288472000 implements MigrationInterface { + name = 'fixChannelUserId1629288472000' + + public async up(queryRunner: QueryRunner): Promise<void> { + await queryRunner.query(`ALTER TABLE "channel" ALTER COLUMN "userId" DROP NOT NULL;`); + } + + public async down(queryRunner: QueryRunner): Promise<void> { + await queryRunner.query(`ALTER TABLE "channel" ALTER COLUMN "userId" SET NOT NULL;`); + } + +} diff --git a/src/models/entities/channel.ts b/src/models/entities/channel.ts index 1868f7514311dcb60648bd32f01038c5da7d8da3..f2d713612d24b11b53529c6d3ab43ae680ab7afe 100644 --- a/src/models/entities/channel.ts +++ b/src/models/entities/channel.ts @@ -23,9 +23,10 @@ export class Channel { @Index() @Column({ ...id(), + nullable: true, comment: 'The owner ID.' }) - public userId: User['id']; + public userId: User['id'] | null; @ManyToOne(type => User, { onDelete: 'SET NULL' diff --git a/src/models/repositories/channel.ts b/src/models/repositories/channel.ts index 3a6bd4c923963e1e6fd8e4c93023a187357bff37..007b1100159a92e28aff0a278a9b1803a0f8c9eb 100644 --- a/src/models/repositories/channel.ts +++ b/src/models/repositories/channel.ts @@ -90,7 +90,7 @@ export const packedChannelSchema = { }, userId: { type: 'string' as const, - nullable: false as const, optional: false as const, + nullable: true as const, optional: false as const, format: 'id', }, },