fix: migration reset
This commit is contained in:
parent
dd7e5aa2f2
commit
808bec7fc8
4 changed files with 7 additions and 59 deletions
|
|
@ -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;
|
|
||||||
|
|
@ -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;
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
-- CreateEnum
|
|
||||||
CREATE TYPE "UserType" AS ENUM ('USER', 'MESSENGER', 'DELEGATE', 'AGENCY');
|
|
||||||
|
|
||||||
-- AlterTable
|
|
||||||
ALTER TABLE "User" ALTER COLUMN "code" DROP NOT NULL;
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
-- CreateEnum
|
-- 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
|
-- CreateTable
|
||||||
CREATE TABLE "Province" (
|
CREATE TABLE "Province" (
|
||||||
|
|
@ -102,11 +105,12 @@ CREATE TABLE "BranchUser" (
|
||||||
CREATE TABLE "User" (
|
CREATE TABLE "User" (
|
||||||
"id" TEXT NOT NULL,
|
"id" TEXT NOT NULL,
|
||||||
"keycloakId" TEXT NOT NULL,
|
"keycloakId" TEXT NOT NULL,
|
||||||
"code" TEXT NOT NULL,
|
"code" TEXT,
|
||||||
"firstName" TEXT NOT NULL,
|
"firstName" TEXT NOT NULL,
|
||||||
"firstNameEN" TEXT NOT NULL,
|
"firstNameEN" TEXT NOT NULL,
|
||||||
"lastName" TEXT NOT NULL,
|
"lastName" TEXT NOT NULL,
|
||||||
"lastNameEN" TEXT NOT NULL,
|
"lastNameEN" TEXT NOT NULL,
|
||||||
|
"gender" TEXT NOT NULL,
|
||||||
"address" TEXT NOT NULL,
|
"address" TEXT NOT NULL,
|
||||||
"addressEN" TEXT NOT NULL,
|
"addressEN" TEXT NOT NULL,
|
||||||
"provinceId" TEXT,
|
"provinceId" TEXT,
|
||||||
|
|
@ -118,7 +122,7 @@ CREATE TABLE "User" (
|
||||||
"registrationNo" TEXT,
|
"registrationNo" TEXT,
|
||||||
"startDate" TIMESTAMP(3),
|
"startDate" TIMESTAMP(3),
|
||||||
"retireDate" TIMESTAMP(3),
|
"retireDate" TIMESTAMP(3),
|
||||||
"userType" TEXT NOT NULL,
|
"userType" "UserType" NOT NULL,
|
||||||
"userRole" TEXT NOT NULL,
|
"userRole" TEXT NOT NULL,
|
||||||
"discountCondition" TEXT,
|
"discountCondition" TEXT,
|
||||||
"licenseNo" TEXT,
|
"licenseNo" TEXT,
|
||||||
Loading…
Add table
Add a link
Reference in a new issue