diff --git a/prisma/migrations/20240405033140_update/migration.sql b/prisma/migrations/20240405033140_update/migration.sql deleted file mode 100644 index 0745fdf..0000000 --- a/prisma/migrations/20240405033140_update/migration.sql +++ /dev/null @@ -1,43 +0,0 @@ -/* - Warnings: - - - The values [USED] on the enum `Status` will be removed. If these variants are still used in the database, this will fail. - -*/ --- AlterEnum -BEGIN; -CREATE TYPE "Status_new" AS ENUM ('CREATED', 'ACTIVE', 'INACTIVE'); -ALTER TABLE "Product" ALTER COLUMN "status" DROP DEFAULT; -ALTER TABLE "Customer" ALTER COLUMN "status" DROP DEFAULT; -ALTER TABLE "Service" ALTER COLUMN "status" DROP DEFAULT; -ALTER TABLE "Work" ALTER COLUMN "status" DROP DEFAULT; -ALTER TABLE "CustomerBranch" ALTER COLUMN "status" DROP DEFAULT; -ALTER TABLE "Employee" ALTER COLUMN "status" DROP DEFAULT; -ALTER TABLE "Branch" ALTER COLUMN "status" DROP DEFAULT; -ALTER TABLE "ProductGroup" ALTER COLUMN "status" DROP DEFAULT; -ALTER TABLE "ProductType" ALTER COLUMN "status" DROP DEFAULT; -ALTER TABLE "User" ALTER COLUMN "status" DROP DEFAULT; -ALTER TABLE "Branch" ALTER COLUMN "status" TYPE "Status_new" USING ("status"::text::"Status_new"); -ALTER TABLE "User" ALTER COLUMN "status" TYPE "Status_new" USING ("status"::text::"Status_new"); -ALTER TABLE "Customer" ALTER COLUMN "status" TYPE "Status_new" USING ("status"::text::"Status_new"); -ALTER TABLE "CustomerBranch" ALTER COLUMN "status" TYPE "Status_new" USING ("status"::text::"Status_new"); -ALTER TABLE "Employee" ALTER COLUMN "status" TYPE "Status_new" USING ("status"::text::"Status_new"); -ALTER TABLE "Service" ALTER COLUMN "status" TYPE "Status_new" USING ("status"::text::"Status_new"); -ALTER TABLE "Work" ALTER COLUMN "status" TYPE "Status_new" USING ("status"::text::"Status_new"); -ALTER TABLE "ProductGroup" ALTER COLUMN "status" TYPE "Status_new" USING ("status"::text::"Status_new"); -ALTER TABLE "ProductType" ALTER COLUMN "status" TYPE "Status_new" USING ("status"::text::"Status_new"); -ALTER TABLE "Product" ALTER COLUMN "status" TYPE "Status_new" USING ("status"::text::"Status_new"); -ALTER TYPE "Status" RENAME TO "Status_old"; -ALTER TYPE "Status_new" RENAME TO "Status"; -DROP TYPE "Status_old"; -ALTER TABLE "Product" ALTER COLUMN "status" SET DEFAULT 'CREATED'; -ALTER TABLE "Customer" ALTER COLUMN "status" SET DEFAULT 'CREATED'; -ALTER TABLE "Service" ALTER COLUMN "status" SET DEFAULT 'CREATED'; -ALTER TABLE "Work" ALTER COLUMN "status" SET DEFAULT 'CREATED'; -ALTER TABLE "CustomerBranch" ALTER COLUMN "status" SET DEFAULT 'CREATED'; -ALTER TABLE "Employee" ALTER COLUMN "status" SET DEFAULT 'CREATED'; -ALTER TABLE "Branch" ALTER COLUMN "status" SET DEFAULT 'CREATED'; -ALTER TABLE "ProductGroup" ALTER COLUMN "status" SET DEFAULT 'CREATED'; -ALTER TABLE "ProductType" ALTER COLUMN "status" SET DEFAULT 'CREATED'; -ALTER TABLE "User" ALTER COLUMN "status" SET DEFAULT 'CREATED'; -COMMIT; diff --git a/prisma/migrations/20240405094638_update/migration.sql b/prisma/migrations/20240405094638_update/migration.sql deleted file mode 100644 index f5bdc4b..0000000 --- a/prisma/migrations/20240405094638_update/migration.sql +++ /dev/null @@ -1,8 +0,0 @@ -/* - Warnings: - - - Added the required column `gender` to the `User` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "User" ADD COLUMN "gender" TEXT NOT NULL; diff --git a/prisma/migrations/20240409040419_update/migration.sql b/prisma/migrations/20240409040419_update/migration.sql deleted file mode 100644 index f43823a..0000000 --- a/prisma/migrations/20240409040419_update/migration.sql +++ /dev/null @@ -1,5 +0,0 @@ --- CreateEnum -CREATE TYPE "UserType" AS ENUM ('USER', 'MESSENGER', 'DELEGATE', 'AGENCY'); - --- AlterTable -ALTER TABLE "User" ALTER COLUMN "code" DROP NOT NULL; diff --git a/prisma/migrations/20240405020304_init/migration.sql b/prisma/migrations/20240409061231_init/migration.sql similarity index 98% rename from prisma/migrations/20240405020304_init/migration.sql rename to prisma/migrations/20240409061231_init/migration.sql index 6693d29..9c0ad32 100644 --- a/prisma/migrations/20240405020304_init/migration.sql +++ b/prisma/migrations/20240409061231_init/migration.sql @@ -1,5 +1,8 @@ -- CreateEnum -CREATE TYPE "Status" AS ENUM ('CREATED', 'USED'); +CREATE TYPE "Status" AS ENUM ('CREATED', 'ACTIVE', 'INACTIVE'); + +-- CreateEnum +CREATE TYPE "UserType" AS ENUM ('USER', 'MESSENGER', 'DELEGATE', 'AGENCY'); -- CreateTable CREATE TABLE "Province" ( @@ -102,11 +105,12 @@ CREATE TABLE "BranchUser" ( CREATE TABLE "User" ( "id" TEXT NOT NULL, "keycloakId" TEXT NOT NULL, - "code" TEXT NOT NULL, + "code" TEXT, "firstName" TEXT NOT NULL, "firstNameEN" TEXT NOT NULL, "lastName" TEXT NOT NULL, "lastNameEN" TEXT NOT NULL, + "gender" TEXT NOT NULL, "address" TEXT NOT NULL, "addressEN" TEXT NOT NULL, "provinceId" TEXT, @@ -118,7 +122,7 @@ CREATE TABLE "User" ( "registrationNo" TEXT, "startDate" TIMESTAMP(3), "retireDate" TIMESTAMP(3), - "userType" TEXT NOT NULL, + "userType" "UserType" NOT NULL, "userRole" TEXT NOT NULL, "discountCondition" TEXT, "licenseNo" TEXT,