-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(seeding): refactored every seeding migrations into SQL only to be…
… able to not break the production one more time Took 1 hour 21 minutes Took 19 seconds
- Loading branch information
Showing
6 changed files
with
87 additions
and
66 deletions.
There are no files selected for viewing
18 changes: 11 additions & 7 deletions
18
backend/back/src/services/seed/1696697379896-CreateGithubService.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 |
---|---|---|
@@ -1,16 +1,20 @@ | ||
import { MigrationInterface, QueryRunner } from "typeorm"; | ||
import Service from "../entities/service.entity"; | ||
|
||
export class CreateGithubService1696697379896 implements MigrationInterface { | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.manager.getRepository(Service).save({ | ||
id: "github", | ||
imageUrl: "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png", | ||
oauthUrl: "https://github.com/login/oauth/authorize", | ||
}); | ||
await queryRunner.query( | ||
`INSERT INTO "service" ("id", "image_url", "oauth_url") | ||
VALUES ('github', | ||
'https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png', | ||
'https://github.com/login/oauth/authorize')`, | ||
); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.manager.getRepository(Service).delete({ id: "github" }); | ||
await queryRunner.query( | ||
`DELETE | ||
FROM "service" | ||
WHERE "id" = 'github'`, | ||
); | ||
} | ||
} |
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
20 changes: 12 additions & 8 deletions
20
backend/back/src/services/seed/1696814128392-CreateTimerService.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 |
---|---|---|
@@ -1,17 +1,21 @@ | ||
import { MigrationInterface, QueryRunner } from "typeorm"; | ||
import Service from "../entities/service.entity"; | ||
|
||
export class CreateTimerService1696814128392 implements MigrationInterface { | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.manager.getRepository(Service).save({ | ||
id: "timer", | ||
imageUrl: "https://cdn-icons-png.flaticon.com/512/1571/1571810.png", | ||
oauthUrl: "", | ||
needConnection: false, | ||
}); | ||
await queryRunner.query( | ||
`INSERT INTO "service" ("id", "image_url", "oauth_url", "need_connection") | ||
VALUES ('timer', | ||
'https://cdn-icons-png.flaticon.com/512/1571/1571810.png', | ||
'', | ||
false)`, | ||
); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.manager.getRepository(Service).delete({ id: "timer" }); | ||
await queryRunner.query( | ||
`DELETE | ||
FROM "service" | ||
WHERE "id" = 'timer'`, | ||
); | ||
} | ||
} |
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