-
Notifications
You must be signed in to change notification settings - Fork 3
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 #189 from waifuvault/premium-buckets
add premium buckets
- Loading branch information
Showing
5 changed files
with
94 additions
and
12 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,24 @@ | ||
import { MigrationInterface, QueryRunner } from "typeorm"; | ||
|
||
export class AddBucketType1726652384908 implements MigrationInterface { | ||
name = 'AddBucketType1726652384908' | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`DROP INDEX "IDX_74d7bc76abfc080b96e42ddac7"`); | ||
await queryRunner.query(`CREATE TABLE "temporary_bucket_model" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "bucketToken" text NOT NULL, "ip" text NOT NULL, "type" text NOT NULL DEFAULT ('NORMAL'), CONSTRAINT "UQ_092bd6d7824bd16ceee201ac5c6" UNIQUE ("ip"))`); | ||
await queryRunner.query(`INSERT INTO "temporary_bucket_model"("id", "createdAt", "updatedAt", "bucketToken", "ip") SELECT "id", "createdAt", "updatedAt", "bucketToken", "ip" FROM "bucket_model"`); | ||
await queryRunner.query(`DROP TABLE "bucket_model"`); | ||
await queryRunner.query(`ALTER TABLE "temporary_bucket_model" RENAME TO "bucket_model"`); | ||
await queryRunner.query(`CREATE UNIQUE INDEX "IDX_74d7bc76abfc080b96e42ddac7" ON "bucket_model" ("bucketToken") `); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`DROP INDEX "IDX_74d7bc76abfc080b96e42ddac7"`); | ||
await queryRunner.query(`ALTER TABLE "bucket_model" RENAME TO "temporary_bucket_model"`); | ||
await queryRunner.query(`CREATE TABLE "bucket_model" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "bucketToken" text NOT NULL, "ip" text NOT NULL, CONSTRAINT "UQ_092bd6d7824bd16ceee201ac5c6" UNIQUE ("ip"))`); | ||
await queryRunner.query(`INSERT INTO "bucket_model"("id", "createdAt", "updatedAt", "bucketToken", "ip") SELECT "id", "createdAt", "updatedAt", "bucketToken", "ip" FROM "temporary_bucket_model"`); | ||
await queryRunner.query(`DROP TABLE "temporary_bucket_model"`); | ||
await queryRunner.query(`CREATE UNIQUE INDEX "IDX_74d7bc76abfc080b96e42ddac7" ON "bucket_model" ("bucketToken") `); | ||
} | ||
|
||
} |
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,6 @@ | ||
enum BucketType { | ||
NORMAL = "NORMAL", | ||
PREMIUM = "PREMIUM", | ||
} | ||
|
||
export default BucketType; |
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