55 lines
2.3 KiB
SQL
55 lines
2.3 KiB
SQL
/*
|
|
Warnings:
|
|
|
|
- You are about to drop the column `expense_code_id` on the `expenses` table. All the data in the column will be lost.
|
|
- You are about to drop the column `shift_code_id` on the `shifts` table. All the data in the column will be lost.
|
|
- You are about to drop the `expense_codes` table. If the table is not empty, all the data it contains will be lost.
|
|
- You are about to drop the `shift_codes` table. If the table is not empty, all the data it contains will be lost.
|
|
- Added the required column `bank_code_id` to the `expenses` table without a default value. This is not possible if the table is not empty.
|
|
- Added the required column `bank_code_id` to the `leave_requests` table without a default value. This is not possible if the table is not empty.
|
|
- Added the required column `bank_code_id` to the `shifts` table without a default value. This is not possible if the table is not empty.
|
|
|
|
*/
|
|
-- DropForeignKey
|
|
ALTER TABLE "expenses" DROP CONSTRAINT "expenses_expense_code_id_fkey";
|
|
|
|
-- DropForeignKey
|
|
ALTER TABLE "shifts" DROP CONSTRAINT "shifts_shift_code_id_fkey";
|
|
|
|
-- AlterTable
|
|
ALTER TABLE "expenses" DROP COLUMN "expense_code_id",
|
|
ADD COLUMN "bank_code_id" INTEGER NOT NULL;
|
|
|
|
-- AlterTable
|
|
ALTER TABLE "leave_requests" ADD COLUMN "bank_code_id" INTEGER NOT NULL;
|
|
|
|
-- AlterTable
|
|
ALTER TABLE "shifts" DROP COLUMN "shift_code_id",
|
|
ADD COLUMN "bank_code_id" INTEGER NOT NULL;
|
|
|
|
-- DropTable
|
|
DROP TABLE "expense_codes";
|
|
|
|
-- DropTable
|
|
DROP TABLE "shift_codes";
|
|
|
|
-- CreateTable
|
|
CREATE TABLE "bank_codes" (
|
|
"id" SERIAL NOT NULL,
|
|
"type" TEXT NOT NULL,
|
|
"categorie" TEXT NOT NULL,
|
|
"modifier" DOUBLE PRECISION NOT NULL,
|
|
"bank_code" TEXT NOT NULL,
|
|
|
|
CONSTRAINT "bank_codes_pkey" PRIMARY KEY ("id")
|
|
);
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE "leave_requests" ADD CONSTRAINT "leave_requests_bank_code_id_fkey" FOREIGN KEY ("bank_code_id") REFERENCES "bank_codes"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE "shifts" ADD CONSTRAINT "shifts_bank_code_id_fkey" FOREIGN KEY ("bank_code_id") REFERENCES "bank_codes"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE "expenses" ADD CONSTRAINT "expenses_bank_code_id_fkey" FOREIGN KEY ("bank_code_id") REFERENCES "bank_codes"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|