diff --git a/src/migrations/1705725351584-modify-user-review-table.ts b/src/migrations/1705725351584-modify-user-review-table.ts deleted file mode 100644 index 19da653d..00000000 --- a/src/migrations/1705725351584-modify-user-review-table.ts +++ /dev/null @@ -1,103 +0,0 @@ -import { - MigrationInterface, - QueryRunner, - Table, - TableColumn, - TableColumnOptions, -} from 'typeorm'; - -const generatePrimaryColumn = ( - comment: string = '고유 ID', -): TableColumnOptions => { - return { - name: 'id', - type: 'int', - unsigned: true, - isPrimary: true, - isNullable: false, - isGenerated: true, - generationStrategy: 'increment', - comment, - }; -}; - -const generateBooleanColumn = ( - name: string, - comment: string, -): TableColumnOptions => { - return { - name: name, - type: 'tinyint', - length: '1', - unsigned: true, - default: 0, - isNullable: false, - comment: comment, - }; -}; - -export class ModifyUserReviewTable1705725351584 implements MigrationInterface { - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.renameTable('user_review', 'mentor_review'); - - // 리뷰 테이블 created_at 추가 - await queryRunner.addColumn( - 'mentor_review', - new TableColumn({ - name: 'created_at', - type: 'timestamp', - isNullable: false, - default: 'CURRENT_TIMESTAMP', - comment: '생성일자', - }), - ); - - // 체크리스트 테이블 - await queryRunner.createTable( - new Table({ - name: 'mentor_review_checklist', - columns: [ - generatePrimaryColumn('멘토 리뷰 체크리스트 고유 ID'), - { - name: 'mentor_review_id', - type: 'int', - unsigned: true, - isNullable: false, - comment: '멘토 리뷰 고유 ID', - }, - generateBooleanColumn('is_good_work', '잘가르쳐요'), - generateBooleanColumn('is_clear', '깔끔해요'), - generateBooleanColumn('is_quick', '답변이 빨라요'), - generateBooleanColumn('is_accurate', '정확해요'), - generateBooleanColumn('is_kindness', '친절해요'), - generateBooleanColumn('is_fun', '재밌어요'), - generateBooleanColumn('is_informative', '알차요'), - generateBooleanColumn('is_bad', '아쉬워요'), - generateBooleanColumn('is_stuffy', '답답해요'), - ], - foreignKeys: [ - { - referencedTableName: 'mentor_review', - referencedColumnNames: ['id'], - columnNames: ['mentor_review_id'], - onDelete: 'CASCADE', - }, - ], - }), - ); - await queryRunner.query( - 'ALTER TABLE mentor_review_checklist COMMENT = "멘토 리뷰 체크리스트"', - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.dropColumn( - 'mentor_review', - new TableColumn({ - name: 'created_at', - type: 'timestamp', - }), - ); - await queryRunner.dropTable(new Table({ name: 'mentor_review_checklist' })); - } -} diff --git a/src/migrations/1705814513284-modify-mentor-review-nullable.ts b/src/migrations/1705814513284-modify-mentor-review-nullable.ts deleted file mode 100644 index 218d1112..00000000 --- a/src/migrations/1705814513284-modify-mentor-review-nullable.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { MigrationInterface, QueryRunner, TableColumn } from 'typeorm'; - -export class ModifyMentorReviewNullable1705814513284 - implements MigrationInterface -{ - public async up(queryRunner: QueryRunner): Promise { - queryRunner.changeColumn( - 'mentor_review', - 'review', - new TableColumn({ - isNullable: true, - length: '255', - name: 'review', - type: 'varchar', - }), - ); - } - - public async down(queryRunner: QueryRunner): Promise { - queryRunner.changeColumn( - 'mentor_review', - 'review', - new TableColumn({ - length: '255', - name: 'review', - type: 'varchar', - }), - ); - } -} diff --git a/src/migrations/1705836905872-mentor-review-soft-delete.ts b/src/migrations/1705836905872-mentor-review-soft-delete.ts deleted file mode 100644 index 719cc6e3..00000000 --- a/src/migrations/1705836905872-mentor-review-soft-delete.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { MigrationInterface, QueryRunner, TableColumn } from 'typeorm'; - -export class MentorReviewSoftDelete1705836905872 implements MigrationInterface { - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.addColumn( - 'mentor_review', - new TableColumn({ - name: 'deleted_at', - type: 'timestamp', - isNullable: true, - comment: '삭제 일자', - }), - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.dropColumn('mentor_review', 'deleted_at'); - } -} diff --git a/src/migrations/1705843495576-mentor-review-checklist-soft-delete.ts b/src/migrations/1705843495576-mentor-review-checklist-soft-delete.ts deleted file mode 100644 index 0ec3af85..00000000 --- a/src/migrations/1705843495576-mentor-review-checklist-soft-delete.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { MigrationInterface, QueryRunner, TableColumn } from 'typeorm'; - -export class MentorReviewChecklistSoftDelete1705843495576 - implements MigrationInterface -{ - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.addColumn( - 'mentor_review_checklist', - new TableColumn({ - name: 'deleted_at', - type: 'timestamp', - isNullable: true, - comment: '삭제 일자', - }), - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.dropColumn('mentor_review_checklist', 'deleted_at'); - } -} diff --git a/src/migrations/1705996137498-userRanking.ts b/src/migrations/1705996137498-userRanking.ts deleted file mode 100644 index a1e09f5d..00000000 --- a/src/migrations/1705996137498-userRanking.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { - MigrationInterface, - QueryRunner, - TableColumn, - TableForeignKey, -} from 'typeorm'; - -export class UserRanking1705996137498 implements MigrationInterface { - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.createForeignKey( - 'user_ranking', - new TableForeignKey({ - columnNames: ['user_id'], - referencedTableName: 'user', - referencedColumnNames: ['id'], - onDelete: 'CASCADE', - }), - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.dropForeignKey('user_ranking', 'user_id'); - } -} diff --git a/src/migrations/1706015414954-modify-total-count-entity-name.ts b/src/migrations/1706015414954-modify-total-count-entity-name.ts deleted file mode 100644 index 741603de..00000000 --- a/src/migrations/1706015414954-modify-total-count-entity-name.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class ModifyTotalCountEntityName1706015414954 - implements MigrationInterface -{ - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.renameColumn( - 'total_count', - 'mentor_board_count_7days', - 'mentor_board_count_in_seven_days', - ); - await queryRunner.renameColumn( - 'total_count', - 'help_you_comment_count_7days', - 'help_you_comment_count_in_seven_days', - ); - await queryRunner.renameColumn( - 'total_count', - 'mentor_board_like_count_7days', - 'mentor_board_like_count_in_seven_days', - ); - await queryRunner.renameColumn( - 'total_count', - 'badge_count_7days', - 'badge_count_in_seven_days', - ); - await queryRunner.renameColumn( - 'total_count', - 'review_count_7days', - 'review_count_in_seven_days', - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.renameColumn( - 'total_count', - 'mentor_board_count_in_seven_days', - 'mentor_board_count_7days', - ); - await queryRunner.renameColumn( - 'total_count', - 'help_you_comment_count_in_seven_days', - 'help_you_comment_count_7days', - ); - await queryRunner.renameColumn( - 'total_count', - 'mentor_board_like_count_in_seven_days', - 'mentor_board_like_count_7days', - ); - await queryRunner.renameColumn( - 'total_count', - 'badge_count_in_seven_days', - 'badge_count_7days', - ); - await queryRunner.renameColumn( - 'total_count', - 'review_count_in_seven_days', - 'review_count_7days', - ); - } -} diff --git a/src/migrations/1706078088801-modify-user-intro-entity.ts b/src/migrations/1706078088801-modify-user-intro-entity.ts deleted file mode 100644 index a1cd5200..00000000 --- a/src/migrations/1706078088801-modify-user-intro-entity.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { MigrationInterface, QueryRunner, TableColumn } from 'typeorm'; - -export class ModifyUserIntroEntity1706078088801 implements MigrationInterface { - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.dropColumns('user_intro', ['main_field', 'introduce']); - await queryRunner.addColumns('user_intro', [ - new TableColumn({ - name: 'short_intro', - type: 'varchar', - isNullable: true, - comment: '한 줄 소개', - length: '100', - }), - new TableColumn({ - name: 'custom_category', - type: 'varchar', - isNullable: true, - comment: '사용자 정의 카테고리', - length: '100', - }), - new TableColumn({ - name: 'detail', - type: 'varchar', - isNullable: true, - comment: '상세 소개', - length: '3000', - }), - new TableColumn({ - name: 'portfolio', - type: 'varchar', - isNullable: true, - comment: '포트폴리오', - length: '255', - }), - new TableColumn({ - name: 'sns', - type: 'varchar', - isNullable: true, - comment: 'SNS', - length: '255', - }), - ]); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.dropColumns('user_intro', [ - 'short_intro', - 'custom_category', - 'detail', - 'portfolio', - 'sns', - ]); - await queryRunner.addColumns('user_intro', [ - new TableColumn({ - name: 'main_field', - type: 'varchar', - isNullable: true, - comment: '주 분야', - length: '100', - }), - new TableColumn({ - name: 'introduce', - type: 'varchar', - isNullable: true, - comment: '소개', - length: '3000', - }), - ]); - } -} diff --git a/src/migrations/1706596603421-modify-user-ranking-entity.ts b/src/migrations/1706596603421-modify-user-ranking-entity.ts deleted file mode 100644 index c2ef3e17..00000000 --- a/src/migrations/1706596603421-modify-user-ranking-entity.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { MigrationInterface, QueryRunner, TableColumn } from 'typeorm'; - -export class ModifyUserRankingEntity1706596603421 - implements MigrationInterface -{ - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.dropColumns('user_ranking', ['main_field', 'introduce']); - await queryRunner.addColumns('user_ranking', [ - new TableColumn({ - name: 'short_intro', - type: 'varchar', - isNullable: true, - comment: '한 줄 소개', - length: '100', - }), - new TableColumn({ - name: 'custom_category', - type: 'varchar', - isNullable: true, - comment: '사용자 정의 카테고리', - length: '100', - }), - ]); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.dropColumns('user_ranking', [ - 'short_intro', - 'custom_category', - ]); - await queryRunner.addColumns('user_ranking', [ - new TableColumn({ - name: 'main_field', - type: 'varchar', - isNullable: true, - comment: '주 분야', - length: '100', - }), - new TableColumn({ - name: 'introduce', - type: 'varchar', - isNullable: true, - comment: '한 줄 소개', - length: '100', - }), - ]); - } -} diff --git a/src/migrations/1706633729950-modify-help-me-board-pulling-up.ts b/src/migrations/1706633729950-modify-help-me-board-pulling-up.ts deleted file mode 100644 index d848d7d4..00000000 --- a/src/migrations/1706633729950-modify-help-me-board-pulling-up.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { MigrationInterface, QueryRunner, TableColumn } from 'typeorm'; - -export class ModifyHelpMeBoardPullingUp1706633729950 - implements MigrationInterface -{ - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.changeColumn( - 'help_me_board', - 'pulling_up', - new TableColumn({ - name: 'pulling_up', - isNullable: true, - type: 'timestamp', - comment: '끌어올리기 된 일자', - }), - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.changeColumn( - 'help_me_board', - 'pulling_up', - new TableColumn({ - name: 'pulling_up', - isNullable: false, - type: 'timestamp', - }), - ); - } -} diff --git a/src/migrations/1706687627541-create-mentor-review-checklist-count-table.ts b/src/migrations/1706687627541-create-mentor-review-checklist-count-table.ts deleted file mode 100644 index 6f678184..00000000 --- a/src/migrations/1706687627541-create-mentor-review-checklist-count-table.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { - generatePrimaryColumn, - generateCountColumn, - generateCreatedAtColumn, -} from '@src/migrations/__utils/util'; -import { MigrationInterface, QueryRunner, Table } from 'typeorm'; - -export class CreateMentorReviewChecklistCountTable1706687627541 - implements MigrationInterface -{ - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.createTable( - new Table({ - name: 'mentor_review_checklist_count', - columns: [ - generatePrimaryColumn('멘토 리뷰 체크리스트 카운트 고유ID'), - { - name: 'user_id', - type: 'int', - isNullable: false, - comment: '멘토 리뷰 체크리스트 카운트 유저 고유 ID', - }, - generateCountColumn('is_good_work_count', '잘가르쳐요'), - generateCountColumn('is_clear_count', '깔끔해요'), - generateCountColumn('is_quick_count', '답변이 빨라요'), - generateCountColumn('is_accurate_count', '정확해요'), - generateCountColumn('is_kindness_count', '친절해요'), - generateCountColumn('is_fun_count', '재밌어요'), - generateCountColumn('is_informative_count', '알차요'), - generateCountColumn('is_bad_count', '아쉬워요'), - generateCountColumn('is_stuffy_count', '답답해요'), - generateCreatedAtColumn(), - ], - foreignKeys: [ - { - referencedTableName: 'user', - referencedColumnNames: ['id'], - columnNames: ['user_id'], - onDelete: 'CASCADE', - onUpdate: 'CASCADE', - }, - ], - }), - ); - - await queryRunner.query( - 'ALTER TABLE mentor_review_checklist_count COMMENT = "멘토 리뷰 체크리스트 카운트"', - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.dropTable('mentor_review_checklist_count'); - } -} diff --git a/src/migrations/1707370531264-modify-mentor-review-checklist-count-created-at.ts b/src/migrations/1707370531264-modify-mentor-review-checklist-count-created-at.ts deleted file mode 100644 index 592195f5..00000000 --- a/src/migrations/1707370531264-modify-mentor-review-checklist-count-created-at.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { MigrationInterface, QueryRunner, TableColumn } from 'typeorm'; - -export class ModifyMentorReviewChecklistCountCreatedAt1707368183530 - implements MigrationInterface -{ - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.changeColumn( - 'mentor_review_checklist_count', - 'createdAt', - new TableColumn({ - name: 'created_at', - type: 'timestamp', - isNullable: false, - default: 'CURRENT_TIMESTAMP', - comment: '생성일자', - }), - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.changeColumn( - 'mentor_review_checklist_count', - 'created_at', - new TableColumn({ - name: 'createdAt', - type: 'timestamp', - isNullable: false, - default: 'CURRENT_TIMESTAMP', - }), - ); - } -} diff --git a/src/migrations/1707822958189-drop-mentor-review-checklist-table.ts b/src/migrations/1707822958189-drop-mentor-review-checklist-table.ts deleted file mode 100644 index 58a47077..00000000 --- a/src/migrations/1707822958189-drop-mentor-review-checklist-table.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { - generateBooleanColumn, - generatePrimaryColumn, -} from '@src/migrations/__utils/util'; -import { MigrationInterface, QueryRunner, Table } from 'typeorm'; - -export class DropMentorReviewChecklistTable1707822958189 - implements MigrationInterface -{ - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.dropTable('mentor_review_checklist'); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.createTable( - new Table({ - name: 'mentor_review_checklist', - columns: [ - generatePrimaryColumn('멘토 리뷰 체크리스트 고유 ID'), - { - name: 'mentor_review_id', - type: 'int', - unsigned: true, - isNullable: false, - comment: '멘토 리뷰 고유 ID', - }, - generateBooleanColumn('is_good_work', '잘가르쳐요'), - generateBooleanColumn('is_clear', '깔끔해요'), - generateBooleanColumn('is_quick', '답변이 빨라요'), - generateBooleanColumn('is_accurate', '정확해요'), - generateBooleanColumn('is_kindness', '친절해요'), - generateBooleanColumn('is_fun', '재밌어요'), - generateBooleanColumn('is_informative', '알차요'), - generateBooleanColumn('is_bad', '아쉬워요'), - generateBooleanColumn('is_stuffy', '답답해요'), - ], - foreignKeys: [ - { - referencedTableName: 'mentor_review', - referencedColumnNames: ['id'], - columnNames: ['mentor_review_id'], - onDelete: 'CASCADE', - }, - ], - }), - ); - await queryRunner.query( - 'ALTER TABLE mentor_review_checklist COMMENT = "멘토 리뷰 체크리스트"', - ); - } -} diff --git a/src/migrations/1707823007803-alter-mentor-review-table.ts b/src/migrations/1707823007803-alter-mentor-review-table.ts deleted file mode 100644 index 401e1d4e..00000000 --- a/src/migrations/1707823007803-alter-mentor-review-table.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { generateBooleanColumn } from '@src/migrations/__utils/util'; -import { MigrationInterface, QueryRunner, TableColumn } from 'typeorm'; - -export class AlterMentorReviewTable1707823007803 implements MigrationInterface { - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.addColumns('mentor_review', [ - new TableColumn(generateBooleanColumn('is_good_work', '잘가르쳐요')), - new TableColumn(generateBooleanColumn('is_clear', '깔끔해요')), - new TableColumn(generateBooleanColumn('is_quick', '답변이 빨라요')), - new TableColumn(generateBooleanColumn('is_accurate', '정확해요')), - new TableColumn(generateBooleanColumn('is_kindness', '친절해요')), - new TableColumn(generateBooleanColumn('is_fun', '재밌어요')), - new TableColumn(generateBooleanColumn('is_informative', '알차요')), - new TableColumn(generateBooleanColumn('is_bad', '아쉬워요')), - new TableColumn(generateBooleanColumn('is_stuffy', '답답해요')), - ]); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.dropColumns('mentor_review', [ - 'is_good_work', - 'is_clear', - 'is_quick', - 'is_accurate', - 'is_kindness', - 'is_fun', - 'is_informative', - 'is_bad', - 'is_stuffy', - ]); - } -} diff --git a/src/migrations/1707839631749-add-updated-at-mentor-review-table.ts b/src/migrations/1707839631749-add-updated-at-mentor-review-table.ts deleted file mode 100644 index 26655d3a..00000000 --- a/src/migrations/1707839631749-add-updated-at-mentor-review-table.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { generateUpdatedAtColumn } from '@src/migrations/__utils/util'; -import { MigrationInterface, QueryRunner, TableColumn } from 'typeorm'; - -export class AddUpdatedAtMentorReviewTable1707839631749 - implements MigrationInterface -{ - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.addColumn( - 'mentor_review', - new TableColumn(generateUpdatedAtColumn()), - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.dropColumn('mentor_review', 'updated_at'); - } -} diff --git a/src/migrations/1707897149688-add-column-at-mentor-review-table.ts b/src/migrations/1707897149688-add-column-at-mentor-review-table.ts deleted file mode 100644 index 9e7c3696..00000000 --- a/src/migrations/1707897149688-add-column-at-mentor-review-table.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { - generateBooleanColumn, - generateCountColumn, -} from '@src/migrations/__utils/util'; -import { MigrationInterface, QueryRunner, TableColumn } from 'typeorm'; - -export class AddColumnAtMentorReviewTable1707897149688 - implements MigrationInterface -{ - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.addColumn( - 'mentor_review', - new TableColumn( - generateBooleanColumn('is_understand_well', '이해가 잘돼요'), - ), - ); - - await queryRunner.addColumn( - 'mentor_review_checklist_count', - new TableColumn( - generateCountColumn('is_understand_well_count', '이해가 잘돼요'), - ), - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.dropColumn('mentor_review', 'is_understand_well'); - await queryRunner.dropColumn( - 'mentor_review_checklist_count', - 'is_understand_well_count', - ); - } -} diff --git a/src/migrations/1707977815270-update-user-badge.ts b/src/migrations/1707977815270-update-user-badge.ts deleted file mode 100644 index 47b0b768..00000000 --- a/src/migrations/1707977815270-update-user-badge.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { MigrationInterface, QueryRunner, TableColumn } from 'typeorm'; - -export class UpdateUserBadge1707977815270 implements MigrationInterface { - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.changeColumn( - 'user_badge', - 'created_at', - new TableColumn({ - name: 'created_at', - type: 'timestamp', - isNullable: false, - default: 'CURRENT_TIMESTAMP', - comment: '생성일자', - }), - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.changeColumn( - 'user_badge', - 'created_at', - new TableColumn({ - name: 'created_at', - type: 'date', - isNullable: true, - }), - ); - } -} diff --git a/src/migrations/1708423002121-soft-delete-user.ts b/src/migrations/1708423002121-soft-delete-user.ts deleted file mode 100644 index 37b688a2..00000000 --- a/src/migrations/1708423002121-soft-delete-user.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { generateDeletedAtColumn } from '@src/migrations/__utils/util'; -import { UserStatus } from '@src/users/constants/user-status.enum'; -import { MigrationInterface, QueryRunner, TableColumn } from 'typeorm'; - -export class SoftDeleteUser1708423002121 implements MigrationInterface { - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.addColumns('user', [ - new TableColumn({ - name: 'status', - type: 'enum', - enum: [UserStatus.ACTIVE, UserStatus.INACTIVE], - default: `'${UserStatus.ACTIVE}'`, - isNullable: false, - comment: '유저 상태', - }), - new TableColumn(generateDeletedAtColumn()), - ]); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.dropColumns('user', ['status', 'deleted_at']); - } -} diff --git a/src/migrations/1708424573050-create-report-table.ts b/src/migrations/1708424573050-create-report-table.ts deleted file mode 100644 index 3c4ec1f2..00000000 --- a/src/migrations/1708424573050-create-report-table.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { - generateCreatedAtColumn, - generateDeletedAtColumn, - generatePrimaryColumn, -} from '@src/migrations/__utils/util'; -import { ReportType } from '@src/reports/constants/report-type.enum'; -import { MigrationInterface, QueryRunner, Table, TableColumn } from 'typeorm'; - -export class CreateReportTable1708424573050 implements MigrationInterface { - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.createTable( - new Table({ - name: 'report', - columns: [ - generatePrimaryColumn('신고 고유 ID'), - new TableColumn({ - name: 'user_id', - type: 'int', - isNullable: false, - comment: '유저 고유 ID', - }), - new TableColumn({ - name: 'type', - type: 'enum', - enum: [ - ReportType.HateSpeech, - ReportType.IllegalPost, - ReportType.PromotionalPost, - ], - isNullable: false, - comment: '신고 타입', - }), - new TableColumn({ - name: 'reason', - type: 'varchar', - length: '255', - isNullable: false, - comment: '신고 상세 사유', - }), - generateCreatedAtColumn(), - generateDeletedAtColumn(), - ], - foreignKeys: [ - { - referencedColumnNames: ['id'], - columnNames: ['user_id'], - referencedTableName: 'user', - onDelete: 'CASCADE', - onUpdate: 'CASCADE', - }, - ], - }), - ); - - await queryRunner.query('ALTER TABLE report COMMENT = "신고 테이블"'); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.dropTable('report'); - } -} diff --git a/src/migrations/1708426630668-create-banned-user-table.ts b/src/migrations/1708426630668-create-banned-user-table.ts deleted file mode 100644 index 4774c269..00000000 --- a/src/migrations/1708426630668-create-banned-user-table.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { generatePrimaryColumn } from '@src/migrations/__utils/util'; -import { MigrationInterface, QueryRunner, Table, TableColumn } from 'typeorm'; - -export class CreateBannedUserTable1708426630668 implements MigrationInterface { - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.createTable( - new Table({ - name: 'banned_user', - columns: [ - generatePrimaryColumn('밴된 유저 테이블 데이터 고유 ID'), - new TableColumn({ - name: 'user_id', - type: 'int', - isNullable: false, - comment: '유저 고유 ID', - }), - new TableColumn({ - name: 'reason', - type: 'varchar', - length: '200', - isNullable: false, - comment: '정지 사유', - }), - new TableColumn({ - name: 'banned_at', - type: 'timestamp', - isNullable: false, - default: 'CURRENT_TIMESTAMP', - comment: '정지 당한 날짜', - }), - new TableColumn({ - name: 'end_at', - type: 'timestamp', - isNullable: false, - comment: '정지가 끝나는 날짜', - }), - ], - foreignKeys: [ - { - referencedTableName: 'user', - referencedColumnNames: ['id'], - columnNames: ['user_id'], - onUpdate: 'CASCADE', - onDelete: 'CASCADE', - }, - ], - }), - ); - - await queryRunner.query( - 'ALTER TABLE `banned_user` COMMENT = "정지 당한 유저 테이블"', - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.dropTable('banned_user'); - } -} diff --git a/src/migrations/1708479086561-boards-soft-delete.ts b/src/migrations/1708479086561-boards-soft-delete.ts deleted file mode 100644 index 578a7e83..00000000 --- a/src/migrations/1708479086561-boards-soft-delete.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { generateDeletedAtColumn } from '@src/migrations/__utils/util'; -import { MigrationInterface, QueryRunner, TableColumn } from 'typeorm'; - -export class BoardsSoftDelete1708479086561 implements MigrationInterface { - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.addColumn( - 'help_me_board', - new TableColumn(generateDeletedAtColumn()), - ); - - await queryRunner.addColumn( - 'help_you_comment', - new TableColumn(generateDeletedAtColumn()), - ); - - await queryRunner.addColumn( - 'mentor_board', - new TableColumn(generateDeletedAtColumn()), - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.dropColumn('help_me_board', 'deleted_at'); - await queryRunner.dropColumn('help_you_comment', 'deleted_at'); - await queryRunner.dropColumn('mentor_board', 'deleted_at'); - } -} diff --git a/src/migrations/1708479985804-user-date-column.ts b/src/migrations/1708479985804-user-date-column.ts deleted file mode 100644 index 44ad38dc..00000000 --- a/src/migrations/1708479985804-user-date-column.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { - generateCreatedAtColumn, - generateUpdatedAtColumn, -} from '@src/migrations/__utils/util'; -import { MigrationInterface, QueryRunner, TableColumn } from 'typeorm'; - -export class UserDateColumn1708479985804 implements MigrationInterface { - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.addColumns('user', [ - new TableColumn(generateCreatedAtColumn()), - new TableColumn(generateUpdatedAtColumn()), - ]); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.dropColumns('user', ['created_at', 'updated_at']); - } -} diff --git a/src/migrations/1708498015531-modify-report-table.ts b/src/migrations/1708498015531-modify-report-table.ts deleted file mode 100644 index ae95a888..00000000 --- a/src/migrations/1708498015531-modify-report-table.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { - MigrationInterface, - QueryRunner, - TableColumn, - TableForeignKey, -} from 'typeorm'; - -export class ModifyReportTable1708498015531 implements MigrationInterface { - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.changeColumn( - 'report', - 'user_id', - new TableColumn({ - name: 'report_user_id', - type: 'int', - isNullable: false, - comment: '신고한 유저 고유 ID', - }), - ); - - await queryRunner.addColumn( - 'report', - new TableColumn({ - name: 'reported_user_id', - type: 'int', - isNullable: false, - comment: '신고 당한 유저 ID', - }), - ); - - await queryRunner.createForeignKey( - 'report', - new TableForeignKey({ - columnNames: ['reported_user_id'], - referencedTableName: 'user', - referencedColumnNames: ['id'], - onDelete: 'CASCADE', - onUpdate: 'CASCADE', - }), - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.changeColumn( - 'report', - 'report_user_id', - new TableColumn({ - name: 'user_id', - type: 'int', - isNullable: false, - comment: '유저 고유 ID', - }), - ); - - await queryRunner.query( - 'ALTER TABLE ma6_menbosha_db.report DROP FOREIGN KEY FK_798954c041abe4b92a8f47d6638;', - ); - - await queryRunner.query( - 'ALTER TABLE ma6_menbosha_db.report DROP COLUMN reported_user_id;', - ); - } -} diff --git a/src/migrations/1708659903406-add-user-unique-id-in-user-table.ts b/src/migrations/1708659903406-add-user-unique-id-in-user-table.ts deleted file mode 100644 index 9d79e14e..00000000 --- a/src/migrations/1708659903406-add-user-unique-id-in-user-table.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { MigrationInterface, QueryRunner, TableColumn } from 'typeorm'; - -export class AddUserUniqueIdInUserTable1708659903406 - implements MigrationInterface -{ - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.addColumn( - 'user', - new TableColumn({ - name: 'unique_id', - type: 'varchar', - length: '100', - isNullable: true, - }), - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.dropColumn('user', 'unique_id'); - } -} diff --git a/src/migrations/1708671355265-modify-banned-user-table.ts b/src/migrations/1708671355265-modify-banned-user-table.ts deleted file mode 100644 index 3d23109b..00000000 --- a/src/migrations/1708671355265-modify-banned-user-table.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { - MigrationInterface, - QueryRunner, - TableColumn, - TableForeignKey, -} from 'typeorm'; - -export class ModifyBannedUserTable1708671355265 implements MigrationInterface { - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.changeColumn( - 'banned_user', - 'user_id', - new TableColumn({ - name: 'ban_user_id', - type: 'int', - isNullable: false, - comment: '밴한 어드민 고유 ID', - }), - ); - - await queryRunner.addColumn( - 'banned_user', - new TableColumn({ - isUnique: true, - name: 'banned_user_id', - type: 'int', - isNullable: false, - comment: '밴 당한 유저 고유 ID', - }), - ); - - await queryRunner.createForeignKey( - 'banned_user', - new TableForeignKey({ - name: 'fk_banned_user_id', - columnNames: ['banned_user_id'], - referencedTableName: 'user', - referencedColumnNames: ['id'], - onDelete: 'CASCADE', - onUpdate: 'CASCADE', - }), - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.changeColumn( - 'banned_user', - 'ban_user_id', - new TableColumn({ - name: 'user_id', - type: 'int', - isNullable: false, - comment: '유저 고유 ID', - }), - ); - - await queryRunner.query( - 'ALTER TABLE ma6_menbosha_db.banned_user DROP FOREIGN KEY fk_banned_user_id;', - ); - - await queryRunner.query( - 'ALTER TABLE ma6_menbosha_db.banned_user DROP KEY IDX_7a417d9ade1a42e5a3848157f4;', - ); - - await queryRunner.query( - 'ALTER TABLE ma6_menbosha_db.banned_user DROP COLUMN banned_user_id;', - ); - } -} diff --git a/src/migrations/1708753315170-modify-user-role-type-and-name-convention.ts b/src/migrations/1708753315170-modify-user-role-type-and-name-convention.ts deleted file mode 100644 index 136b1761..00000000 --- a/src/migrations/1708753315170-modify-user-role-type-and-name-convention.ts +++ /dev/null @@ -1,80 +0,0 @@ -import { UserRole } from '@src/users/constants/user-role.enum'; -import { MigrationInterface, QueryRunner, TableColumn } from 'typeorm'; - -export class ModifyUserRoleTypeAndNameConvention1708753315170 - implements MigrationInterface -{ - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.changeColumns('user', [ - { - oldColumn: new TableColumn({ - name: 'isMentor', - type: 'tinyint', - }), - newColumn: new TableColumn({ - name: 'is_mentor', - type: 'tinyint', - default: 0, - unsigned: true, - length: '1', - isNullable: false, - comment: '멘토 여부 (0: 멘티, 1: 멘토)', - }), - }, - { - oldColumn: new TableColumn({ - name: 'admin', - type: 'tinyint', - }), - newColumn: new TableColumn({ - name: 'role', - type: 'enum', - enum: [UserRole.ADMIN, UserRole.USER], - default: `'${UserRole.USER}'`, - isNullable: false, - comment: '유저 역할', - }), - }, - ]); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.changeColumns('user', [ - { - oldColumn: new TableColumn({ - name: 'is_mentor', - type: 'tinyint', - default: 0, - unsigned: true, - length: '1', - isNullable: false, - comment: '멘토 여부 (0: 멘티, 1: 멘토)', - }), - newColumn: new TableColumn({ - name: 'isMentor', - type: 'tinyint', - default: 0, - length: '1', - isNullable: false, - }), - }, - { - oldColumn: new TableColumn({ - name: 'role', - type: 'enum', - enum: [UserRole.ADMIN, UserRole.USER], - default: `'${UserRole.USER}'`, - isNullable: false, - comment: '유저 역할', - }), - newColumn: new TableColumn({ - name: 'admin', - type: 'tinyint', - default: 0, - length: '1', - isNullable: false, - }), - }, - ]); - } -} diff --git a/src/migrations/1708766260162-modify-banned-user-table.ts b/src/migrations/1708766260162-modify-banned-user-table.ts deleted file mode 100644 index 3e7a7bd6..00000000 --- a/src/migrations/1708766260162-modify-banned-user-table.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { MigrationInterface, QueryRunner, TableColumn } from 'typeorm'; - -export class ModifyBannedUserTable1708766260162 implements MigrationInterface { - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.changeColumn( - 'banned_user', - 'end_at', - new TableColumn({ - name: 'end_at', - type: 'datetime', - isNullable: false, - comment: '정지가 끝나는 날짜', - }), - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.changeColumn( - 'banned_user', - 'end_at', - new TableColumn({ - name: 'end_at', - type: 'timestamp', - isNullable: false, - comment: '정지가 끝나는 날짜', - }), - ); - } -} diff --git a/src/migrations/1708912227576-drop-unique-banned-user-table.ts b/src/migrations/1708912227576-drop-unique-banned-user-table.ts deleted file mode 100644 index 53d42703..00000000 --- a/src/migrations/1708912227576-drop-unique-banned-user-table.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { MigrationInterface, QueryRunner, TableForeignKey } from 'typeorm'; - -export class DropUniqueBannedUserTable1708912227576 - implements MigrationInterface -{ - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - 'ALTER TABLE banned_user DROP FOREIGN KEY fk_banned_user_id;', - ); - - await queryRunner.query( - 'ALTER TABLE banned_user DROP KEY IDX_7a417d9ade1a42e5a3848157f4;', - ); - - await queryRunner.createForeignKey( - 'banned_user', - new TableForeignKey({ - name: 'fk_banned_user_id', - columnNames: ['banned_user_id'], - referencedTableName: 'user', - referencedColumnNames: ['id'], - onDelete: 'CASCADE', - onUpdate: 'CASCADE', - }), - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.dropForeignKey('banned_user', 'fk_banned_user_id'); - - await queryRunner.query( - 'ALTER TABLE ma6_menbosha_db.banned_user ADD UNIQUE KEY IDX_7a417d9ade1a42e5a3848157f4 (banned_user_id);', - ); - - await queryRunner.createForeignKey( - 'banned_user', - new TableForeignKey({ - name: 'fk_banned_user_id', - columnNames: ['banned_user_id'], - referencedTableName: 'user', - referencedColumnNames: ['id'], - onDelete: 'CASCADE', - onUpdate: 'CASCADE', - }), - ); - } -} diff --git a/src/migrations/1708913292118-modify-user-default-option.ts b/src/migrations/1708913292118-modify-user-default-option.ts deleted file mode 100644 index b07d5e22..00000000 --- a/src/migrations/1708913292118-modify-user-default-option.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { MigrationInterface, QueryRunner, TableColumn } from 'typeorm'; - -export class ModifyUserDefaultOption1708913292118 - implements MigrationInterface -{ - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.changeColumns('user', [ - { - oldColumn: new TableColumn({ - name: 'hope_category_list_id', - type: 'int', - }), - newColumn: new TableColumn({ - name: 'hope_category_list_id', - type: 'int', - default: 1, - comment: '희망 카테고리 아이디', - unsigned: true, - isNullable: false, - }), - }, - { - oldColumn: new TableColumn({ - name: 'activity_category_list_id', - type: 'int', - }), - newColumn: new TableColumn({ - name: 'activity_category_list_id', - type: 'int', - default: 1, - comment: '활동 카테고리 아이디', - unsigned: true, - isNullable: false, - }), - }, - ]); - } - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.changeColumns('user', [ - { - oldColumn: new TableColumn({ - name: 'hope_category_list_id', - type: 'int', - default: 1, - comment: '희망 카테고리 아이디', - unsigned: true, - isNullable: false, - }), - newColumn: new TableColumn({ - name: 'hope_category_list_id', - type: 'int', - }), - }, - { - oldColumn: new TableColumn({ - name: 'activity_category_list_id', - type: 'int', - default: 1, - comment: '활동 카테고리 아이디', - unsigned: true, - isNullable: false, - }), - newColumn: new TableColumn({ - name: 'activity_category_list_id', - type: 'int', - }), - }, - ]); - } -} diff --git a/src/migrations/1709091725187-modify-user-intro-default-option.ts b/src/migrations/1709091725187-modify-user-intro-default-option.ts deleted file mode 100644 index 3d15584f..00000000 --- a/src/migrations/1709091725187-modify-user-intro-default-option.ts +++ /dev/null @@ -1,171 +0,0 @@ -import { MigrationInterface, QueryRunner, TableColumn } from 'typeorm'; - -export class ModifyUserIntroDefaultOption1709091725187 - implements MigrationInterface -{ - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.changeColumns('user_intro', [ - { - oldColumn: new TableColumn({ - name: 'short_intro', - type: 'varchar', - isNullable: true, - }), - newColumn: new TableColumn({ - name: 'short_intro', - type: 'varchar', - isNullable: false, - default: "'나를 간단하게 소개해봐요.'", - }), - }, - { - oldColumn: new TableColumn({ - name: 'career', - type: 'varchar', - isNullable: true, - }), - newColumn: new TableColumn({ - name: 'career', - type: 'varchar', - isNullable: false, - default: "'나를 어필할만한 경력을 작성해주세요.'", - }), - }, - { - oldColumn: new TableColumn({ - name: 'custom_category', - type: 'varchar', - isNullable: true, - }), - newColumn: new TableColumn({ - name: 'custom_category', - type: 'varchar', - isNullable: false, - default: "'나만의 카테고리를 작성해주세요.'", - }), - }, - { - oldColumn: new TableColumn({ - name: 'detail', - type: 'varchar', - isNullable: true, - }), - newColumn: new TableColumn({ - name: 'detail', - type: 'varchar', - isNullable: false, - default: "'내가 어떤 사람인지 자세하게 작성해주세요.'", - }), - }, - { - oldColumn: new TableColumn({ - name: 'portfolio', - type: 'varchar', - isNullable: true, - }), - newColumn: new TableColumn({ - name: 'portfolio', - type: 'varchar', - isNullable: false, - default: "'나를 소개할 수 있는 링크가 있다면 추가해주세요.'", - }), - }, - { - oldColumn: new TableColumn({ - name: 'sns', - type: 'varchar', - isNullable: true, - }), - newColumn: new TableColumn({ - name: 'sns', - type: 'varchar', - isNullable: false, - default: "'SNS 계정의 링크를 추가해주세요.'", - }), - }, - ]); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.changeColumns('user_intro', [ - { - oldColumn: new TableColumn({ - name: 'short_intro', - type: 'varchar', - isNullable: false, - default: "'나를 간단하게 소개해봐요.'", - }), - newColumn: new TableColumn({ - name: 'short_intro', - type: 'varchar', - isNullable: true, - }), - }, - { - oldColumn: new TableColumn({ - name: 'career', - type: 'varchar', - isNullable: false, - default: "'나를 어필할만한 경력을 작성해주세요.'", - }), - newColumn: new TableColumn({ - name: 'career', - type: 'varchar', - isNullable: true, - }), - }, - { - oldColumn: new TableColumn({ - name: 'custom_category', - type: 'varchar', - isNullable: false, - default: "'나만의 카테고리를 작성해주세요.'", - }), - newColumn: new TableColumn({ - name: 'custom_category', - type: 'varchar', - isNullable: true, - }), - }, - { - oldColumn: new TableColumn({ - name: 'detail', - type: 'varchar', - isNullable: false, - default: "'내가 어떤 사람인지 자세하게 작성해주세요.'", - }), - newColumn: new TableColumn({ - name: 'detail', - type: 'varchar', - isNullable: true, - }), - }, - { - oldColumn: new TableColumn({ - name: 'portfolio', - type: 'varchar', - isNullable: false, - default: "'나를 소개할 수 있는 링크가 있다면 추가해주세요.'", - }), - newColumn: new TableColumn({ - name: 'portfolio', - type: 'varchar', - isNullable: true, - }), - }, - { - oldColumn: new TableColumn({ - name: 'sns', - type: 'varchar', - isNullable: false, - default: "'SNS 계정의 링크를 추가해주세요.'", - }), - newColumn: new TableColumn({ - name: 'sns', - type: 'varchar', - isNullable: true, - }), - }, - ]); - } -}