-
Notifications
You must be signed in to change notification settings - Fork 571
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7329 from ever-co/develop
* update: add order to status entity * update: add order to itaskstatus * update:add order to default global statues * update:add isCollapsed to itaskstatus * update:add isCollapsed to status entity * update: add isCollapsed to dfault global statuses * feat: migration alter table status * feat: add log * feat: set PoolSize for PostgreSQL using new way in TypeORM * chore: we can now run 32 replicas for API in our k8s (hope so) * fix button actions container have tiny background when no action available (#7318) * fix: #7279 | fix button actions container have tiny background when no action available * revert default DB_TYPE and DB_PASS --------- Co-authored-by: maceteligolden <[email protected]> Co-authored-by: Kifungo A <[email protected]> Co-authored-by: coderNadir <[email protected]>
- Loading branch information
Showing
10 changed files
with
152 additions
and
9 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
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
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
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
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
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
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
114 changes: 114 additions & 0 deletions
114
packages/core/src/database/migrations/1702757210999-AlterTableStatus.ts
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,114 @@ | ||
|
||
import { MigrationInterface, QueryRunner } from "typeorm"; | ||
import * as chalk from 'chalk'; | ||
|
||
|
||
export class AlterTableStatus1702757210999 implements MigrationInterface { | ||
|
||
name = 'AlterTableStatus1702757210999'; | ||
|
||
/** | ||
* Up Migration | ||
* | ||
* @param queryRunner | ||
*/ | ||
public async up(queryRunner: QueryRunner): Promise<any> { | ||
console.log(chalk.yellow(this.name + ' start running!')); | ||
if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { | ||
await this.sqliteUpQueryRunner(queryRunner); | ||
} else { | ||
await this.postgresUpQueryRunner(queryRunner); | ||
} | ||
} | ||
|
||
/** | ||
* Down Migration | ||
* | ||
* @param queryRunner | ||
*/ | ||
public async down(queryRunner: QueryRunner): Promise<any> { | ||
if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { | ||
await this.sqliteDownQueryRunner(queryRunner); | ||
} else { | ||
await this.postgresDownQueryRunner(queryRunner); | ||
} | ||
} | ||
|
||
/** | ||
* PostgresDB Up Migration | ||
* | ||
* @param queryRunner | ||
*/ | ||
public async postgresUpQueryRunner(queryRunner: QueryRunner): Promise<any> { | ||
await queryRunner.query(`ALTER TABLE "task_status" ADD "order" integer`); | ||
await queryRunner.query(`ALTER TABLE "task_status" ADD CONSTRAINT "UQ_007307d7c7ddab3fe3a65e30351" UNIQUE ("order")`); | ||
await queryRunner.query(`ALTER TABLE "task_status" ADD "isCollapsed" boolean NOT NULL DEFAULT false`); | ||
} | ||
|
||
/** | ||
* PostgresDB Down Migration | ||
* | ||
* @param queryRunner | ||
*/ | ||
public async postgresDownQueryRunner(queryRunner: QueryRunner): Promise<any> { | ||
await queryRunner.query(`ALTER TABLE "task_status" DROP COLUMN "isCollapsed"`); | ||
await queryRunner.query(`ALTER TABLE "task_status" DROP CONSTRAINT "UQ_007307d7c7ddab3fe3a65e30351"`); | ||
await queryRunner.query(`ALTER TABLE "task_status" DROP COLUMN "order"`); | ||
} | ||
|
||
/** | ||
* SqliteDB and BetterSQlite3DB Up Migration | ||
* | ||
* @param queryRunner | ||
*/ | ||
public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise<any> { | ||
await queryRunner.query(`DROP INDEX "IDX_a19e8975e5c296640d457dfc11"`); | ||
await queryRunner.query(`DROP INDEX "IDX_68eaba689ed6d3e27ec93d3e88"`); | ||
await queryRunner.query(`DROP INDEX "IDX_b0c955f276679dd2b2735c3936"`); | ||
await queryRunner.query(`DROP INDEX "IDX_9b9a828a49f4bd6383a4073fe2"`); | ||
await queryRunner.query(`DROP INDEX "IDX_efbaf00a743316b394cc31e4a2"`); | ||
await queryRunner.query(`DROP INDEX "IDX_0330b4a942b536d8d1f264abe3"`); | ||
await queryRunner.query(`DROP INDEX "IDX_25d9737ee153411871b4d20c67"`); | ||
await queryRunner.query(`DROP INDEX "IDX_79c525a8c2209e90186bfcbea9"`); | ||
await queryRunner.query(`CREATE TABLE "temporary_task_status" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "value" varchar NOT NULL, "description" varchar, "icon" varchar, "color" varchar, "isSystem" boolean NOT NULL DEFAULT (0), "projectId" varchar, "organizationTeamId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "order" integer, "isCollapsed" boolean NOT NULL DEFAULT (0), CONSTRAINT "UQ_cc7abdfc6b4db2aee3b5ecad795" UNIQUE ("order"), CONSTRAINT "FK_0330b4a942b536d8d1f264abe32" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a19e8975e5c296640d457dfc11f" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_efbaf00a743316b394cc31e4a20" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_9b9a828a49f4bd6383a4073fe23" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`); | ||
await queryRunner.query(`INSERT INTO "temporary_task_status"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt" FROM "task_status"`); | ||
await queryRunner.query(`DROP TABLE "task_status"`); | ||
await queryRunner.query(`ALTER TABLE "temporary_task_status" RENAME TO "task_status"`); | ||
await queryRunner.query(`CREATE INDEX "IDX_a19e8975e5c296640d457dfc11" ON "task_status" ("projectId") `); | ||
await queryRunner.query(`CREATE INDEX "IDX_68eaba689ed6d3e27ec93d3e88" ON "task_status" ("value") `); | ||
await queryRunner.query(`CREATE INDEX "IDX_b0c955f276679dd2b2735c3936" ON "task_status" ("name") `); | ||
await queryRunner.query(`CREATE INDEX "IDX_9b9a828a49f4bd6383a4073fe2" ON "task_status" ("organizationId") `); | ||
await queryRunner.query(`CREATE INDEX "IDX_efbaf00a743316b394cc31e4a2" ON "task_status" ("tenantId") `); | ||
await queryRunner.query(`CREATE INDEX "IDX_0330b4a942b536d8d1f264abe3" ON "task_status" ("organizationTeamId") `); | ||
await queryRunner.query(`CREATE INDEX "IDX_25d9737ee153411871b4d20c67" ON "task_status" ("isActive") `); | ||
await queryRunner.query(`CREATE INDEX "IDX_79c525a8c2209e90186bfcbea9" ON "task_status" ("isArchived") `); | ||
} | ||
|
||
/** | ||
* SqliteDB and BetterSQlite3DB Down Migration | ||
* | ||
* @param queryRunner | ||
*/ | ||
public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise<any> { | ||
await queryRunner.query(`DROP INDEX "IDX_79c525a8c2209e90186bfcbea9"`); | ||
await queryRunner.query(`DROP INDEX "IDX_25d9737ee153411871b4d20c67"`); | ||
await queryRunner.query(`DROP INDEX "IDX_0330b4a942b536d8d1f264abe3"`); | ||
await queryRunner.query(`DROP INDEX "IDX_efbaf00a743316b394cc31e4a2"`); | ||
await queryRunner.query(`DROP INDEX "IDX_9b9a828a49f4bd6383a4073fe2"`); | ||
await queryRunner.query(`DROP INDEX "IDX_b0c955f276679dd2b2735c3936"`); | ||
await queryRunner.query(`DROP INDEX "IDX_68eaba689ed6d3e27ec93d3e88"`); | ||
await queryRunner.query(`DROP INDEX "IDX_a19e8975e5c296640d457dfc11"`); | ||
await queryRunner.query(`ALTER TABLE "task_status" RENAME TO "temporary_task_status"`); | ||
await queryRunner.query(`CREATE TABLE "task_status" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "value" varchar NOT NULL, "description" varchar, "icon" varchar, "color" varchar, "isSystem" boolean NOT NULL DEFAULT (0), "projectId" varchar, "organizationTeamId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_0330b4a942b536d8d1f264abe32" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a19e8975e5c296640d457dfc11f" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_efbaf00a743316b394cc31e4a20" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_9b9a828a49f4bd6383a4073fe23" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`); | ||
await queryRunner.query(`INSERT INTO "task_status"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt" FROM "temporary_task_status"`); | ||
await queryRunner.query(`DROP TABLE "temporary_task_status"`); | ||
await queryRunner.query(`CREATE INDEX "IDX_79c525a8c2209e90186bfcbea9" ON "task_status" ("isArchived") `); | ||
await queryRunner.query(`CREATE INDEX "IDX_25d9737ee153411871b4d20c67" ON "task_status" ("isActive") `); | ||
await queryRunner.query(`CREATE INDEX "IDX_0330b4a942b536d8d1f264abe3" ON "task_status" ("organizationTeamId") `); | ||
await queryRunner.query(`CREATE INDEX "IDX_efbaf00a743316b394cc31e4a2" ON "task_status" ("tenantId") `); | ||
await queryRunner.query(`CREATE INDEX "IDX_9b9a828a49f4bd6383a4073fe2" ON "task_status" ("organizationId") `); | ||
await queryRunner.query(`CREATE INDEX "IDX_b0c955f276679dd2b2735c3936" ON "task_status" ("name") `); | ||
await queryRunner.query(`CREATE INDEX "IDX_68eaba689ed6d3e27ec93d3e88" ON "task_status" ("value") `); | ||
await queryRunner.query(`CREATE INDEX "IDX_a19e8975e5c296640d457dfc11" ON "task_status" ("projectId") `); | ||
} | ||
} |
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
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