-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a5a8aa1
commit 4c163d7
Showing
2 changed files
with
36 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@opendoc/backend": patch | ||
--- | ||
|
||
迁移脚本将自动添加常见的需要禁用的应用编号 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,39 @@ | ||
import { Migration } from '@mikro-orm/migrations'; | ||
/* eslint-disable @typescript-eslint/require-await */ | ||
import { Migration } from '@mikro-orm/migrations' | ||
|
||
export class Migration20240428154537 extends Migration { | ||
const forbiddenCodes = [ | ||
'buka', | ||
'webpack', | ||
'rollup', | ||
'react', | ||
'vue', | ||
'angular', | ||
'nestjs', | ||
'next', | ||
'types', | ||
'nuxt', | ||
'nuxtjs', | ||
'tailwindcss', | ||
'asyncapi', | ||
'shikijs', | ||
'vueuse', | ||
'tabler', | ||
'pinia', | ||
'typescript-eslint', | ||
'eslint', | ||
] | ||
|
||
export class Migration20240428154537 extends Migration { | ||
async up(): Promise<void> { | ||
this.addSql('create table `forbidden_application_code` (`id` bigint unsigned not null auto_increment primary key comment \'主键\', `created_at` datetime not null default CURRENT_TIMESTAMP comment \'创建时间\', `updated_at` datetime not null default CURRENT_TIMESTAMP comment \'更新时间\', `code` varchar(255) not null comment \'唯一应用编码\') default character set utf8mb4 engine = InnoDB;'); | ||
this.addSql('alter table `forbidden_application_code` add unique `forbidden_application_code_code_unique`(`code`);'); | ||
this.addSql('create table `forbidden_application_code` (`id` bigint unsigned not null auto_increment primary key comment \'主键\', `created_at` datetime not null default CURRENT_TIMESTAMP comment \'创建时间\', `updated_at` datetime not null default CURRENT_TIMESTAMP comment \'更新时间\', `code` varchar(255) not null comment \'唯一应用编码\');') | ||
this.addSql('alter table `forbidden_application_code` add unique `forbidden_application_code_code_unique`(`code`);') | ||
|
||
for (const code of forbiddenCodes) { | ||
this.addSql(`insert into \`forbidden_application_code\` (\`code\`) values ('${code}');`) | ||
} | ||
} | ||
|
||
async down(): Promise<void> { | ||
this.addSql('drop table if exists `forbidden_application_code`;'); | ||
this.addSql('drop table if exists `forbidden_application_code`;') | ||
} | ||
|
||
} |