diff --git a/src/core/strings/constants/table.constants.ts b/src/core/strings/constants/table.constants.ts index 470fa71..a2a5475 100644 --- a/src/core/strings/constants/table.constants.ts +++ b/src/core/strings/constants/table.constants.ts @@ -12,7 +12,7 @@ export enum TABLE_NAME { NEWS = 'news', PAYMENT_METHOD = 'payment_methods', PRICE_FORMULA = 'price_formulas', - TRANSACTION_SETTING = 'transaction_settings', + REFUND = 'refunds', REFUND_ITEM = 'refund_items', SEASON_TYPE = 'season_types', @@ -27,6 +27,8 @@ export enum TABLE_NAME { TRANSACTION_ITEM_TAX = 'transaction_item_taxes', TRANSACTION_ITEM_BREAKDOWN_TAX = 't_breakdown_item_taxes', TRANSACTION_DEMOGRAPHY = 'transaction_demographies', + TRANSACTION_SETTING = 'api_settings', + USER = 'users', USER_LOGIN = 'users_login', LOG_USER_LOGIN = 'log_users_login', @@ -47,6 +49,7 @@ export enum TABLE_NAME { TIME_GROUPS = 'time_groups', OTP_VERIFICATIONS = 'otp_verifications', OTP_VERIFIER = 'otp_verifier', - DATA_SCHEDULING = 'data_scheduling', - DATA_SCHEDULING_DEFAULT = 'data_scheduling_default', + + DATA_SCHEDULING = 'event_scheduling', + DATA_SCHEDULING_DEFAULT = 'event_scheduling_default', } diff --git a/src/database/migrations/1745991391299-transaction-setting-model.ts b/src/database/migrations/1745991391299-transaction-setting-model.ts deleted file mode 100644 index f59344a..0000000 --- a/src/database/migrations/1745991391299-transaction-setting-model.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class TransactionSettingModel1745991391299 - implements MigrationInterface -{ - name = 'TransactionSettingModel1745991391299'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `CREATE TABLE "transaction_settings" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "creator_id" character varying(36), "creator_name" character varying(125), "editor_id" character varying(36), "editor_name" character varying(125), "created_at" bigint NOT NULL, "updated_at" bigint NOT NULL, "value" numeric NOT NULL DEFAULT '100', CONSTRAINT "PK_db7fb38a439358b499ebdee4761" PRIMARY KEY ("id"))`, - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(`DROP TABLE "transaction_settings"`); - } -} diff --git a/src/database/migrations/1751455019718-data-scheduling.ts b/src/database/migrations/1751455019718-data-scheduling.ts deleted file mode 100644 index 76f2bc9..0000000 --- a/src/database/migrations/1751455019718-data-scheduling.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class DataScheduling1751455019718 implements MigrationInterface { - name = 'DataScheduling1751455019718'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `CREATE TYPE "public"."data_scheduling_status_enum" AS ENUM('active', 'cancel', 'confirmed', 'draft', 'expired', 'inactive', 'partial refund', 'pending', 'proses refund', 'refunded', 'rejected', 'settled', 'waiting')`, - ); - await queryRunner.query( - `CREATE TABLE "data_scheduling" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "creator_id" character varying(36), "creator_name" character varying(125), "editor_id" character varying(36), "editor_name" character varying(125), "created_at" bigint NOT NULL, "updated_at" bigint NOT NULL, "status" "public"."data_scheduling_status_enum" NOT NULL DEFAULT 'draft', "name" character varying NOT NULL, "indexing_key" character varying NOT NULL, "schedule_date_from" date NOT NULL, "schedule_date_to" date NOT NULL, CONSTRAINT "PK_118219da41190e9b934072b4cc5" PRIMARY KEY ("id"))`, - ); - await queryRunner.query( - `CREATE TABLE "data_scheduling_default" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "creator_id" character varying(36), "creator_name" character varying(125), "editor_id" character varying(36), "editor_name" character varying(125), "created_at" bigint NOT NULL, "updated_at" bigint NOT NULL, "default_value" integer NOT NULL, CONSTRAINT "PK_c0c3bb2b53c67440a9b534d42b9" PRIMARY KEY ("id"))`, - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(`DROP TABLE "data_scheduling_default"`); - await queryRunner.query(`DROP TABLE "data_scheduling"`); - await queryRunner.query(`DROP TYPE "public"."data_scheduling_status_enum"`); - } -} diff --git a/src/database/migrations/1751942902581-renam-table-config.ts b/src/database/migrations/1751942902581-renam-table-config.ts new file mode 100644 index 0000000..3b6ee5a --- /dev/null +++ b/src/database/migrations/1751942902581-renam-table-config.ts @@ -0,0 +1,35 @@ +import { MigrationInterface, QueryRunner } from 'typeorm'; + +export class RenamTableConfig1751942902581 implements MigrationInterface { + name = 'RenamTableConfig1751942902581'; + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `CREATE TABLE "api_settings" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "creator_id" character varying(36), "creator_name" character varying(125), "editor_id" character varying(36), "editor_name" character varying(125), "created_at" bigint NOT NULL, "updated_at" bigint NOT NULL, "value" numeric NOT NULL DEFAULT '100', CONSTRAINT "PK_14bbb118ae1b2bd2385186cffb9" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE TYPE "public"."event_scheduling_status_enum" AS ENUM('active', 'cancel', 'confirmed', 'draft', 'expired', 'inactive', 'partial refund', 'pending', 'proses refund', 'refunded', 'rejected', 'settled', 'waiting')`, + ); + await queryRunner.query( + `CREATE TABLE "event_scheduling" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "creator_id" character varying(36), "creator_name" character varying(125), "editor_id" character varying(36), "editor_name" character varying(125), "created_at" bigint NOT NULL, "updated_at" bigint NOT NULL, "status" "public"."event_scheduling_status_enum" NOT NULL DEFAULT 'draft', "name" character varying NOT NULL, "indexing_key" character varying NOT NULL, "schedule_date_from" date NOT NULL, "schedule_date_to" date NOT NULL, CONSTRAINT "PK_a2ccd3f6ab787b0d7e2af09d30c" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE TABLE "event_scheduling_default" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "creator_id" character varying(36), "creator_name" character varying(125), "editor_id" character varying(36), "editor_name" character varying(125), "created_at" bigint NOT NULL, "updated_at" bigint NOT NULL, "default_value" integer NOT NULL, CONSTRAINT "PK_9caf65330e76243e9f9285ae2e1" PRIMARY KEY ("id"))`, + ); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`DROP TABLE "event_scheduling_default"`); + await queryRunner.query(`DROP TABLE "event_scheduling"`); + await queryRunner.query( + `DROP TYPE "public"."event_scheduling_status_enum"`, + ); + await queryRunner.query(`DROP TABLE "api_settings"`); + await queryRunner.query( + `ALTER TABLE "item_bundlings" ADD CONSTRAINT "FK_a50e7abf2caba4d0394f3726b86" FOREIGN KEY ("item_bundling_id") REFERENCES "items"("id") ON DELETE CASCADE ON UPDATE CASCADE`, + ); + await queryRunner.query( + `ALTER TABLE "queue_tickets" ADD CONSTRAINT "FK_0e9823b8b7ca9523b3be73878e5" FOREIGN KEY ("order_id") REFERENCES "queue_orders"("id") ON DELETE SET NULL ON UPDATE CASCADE`, + ); + } +}