Skip to content

Commit

Permalink
housekeeper: this pr fixes all previous migrations (#4390)
Browse files Browse the repository at this point in the history
* fix all migrations

* 🤖 style: prettify code

* create if not exists
  • Loading branch information
lucasrodes authored and sophiamersmann committed Jan 8, 2025
1 parent 997a3c4 commit d29a33f
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion db/migration/1736177572560-HousekeepingSuggestedReviews.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export class HousekeepingSuggestedReviews1736177572560
{
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`-- sql
CREATE TABLE housekeeping_suggested_reviews (
CREATE TABLE IF NOT EXISTS housekeeping_suggested_reviews (
id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY COMMENT "Identifier of the review",
suggestedAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT "Date where the review was suggested",
objectType VARCHAR(255) NOT NULL UNIQUE COMMENT "Type of the object to review (e.g. 'chart', 'dataset', etc.)",
Expand Down
16 changes: 16 additions & 0 deletions db/migration/1736209759039-RemoveHousekeepingSuggestedReviews.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { MigrationInterface, QueryRunner } from "typeorm"

export class RemoveHousekeepingSuggestedReviews1736209759039
implements MigrationInterface
{
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`DROP TABLE IF EXISTS housekeeping_suggested_reviews`
)
}

// eslint-disable-next-line @typescript-eslint/no-empty-function
public async down(_queryRunner: QueryRunner): Promise<void> {
return
}
}
18 changes: 18 additions & 0 deletions db/migration/1736209905900-CreateHousekeeper.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { MigrationInterface, QueryRunner } from "typeorm"

export class CreateHousekeeper1736209905900 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`-- sql
CREATE TABLE housekeeper_reviews (
id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY COMMENT "Identifier of the review",
suggestedAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT "Date where the review was suggested",
objectType VARCHAR(255) NOT NULL COMMENT "Type of the object to review (e.g. 'chart', 'dataset', etc.)",
objectId INTEGER NOT NULL COMMENT "ID of the object to review"
)
`)
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DROP TABLE housekeeper_reviews`)
}
}

0 comments on commit d29a33f

Please sign in to comment.