/*
  Warnings:

  - You are about to drop the column `patch` on the `attachment_variants` table. All the data in the column will be lost.
  - You are about to alter the column `amount` on the `expenses` table. The data in that column could be lost. The data in that column will be cast from `Money` to `Decimal(12,2)`.
  - You are about to alter the column `amount` on the `expenses_archive` table. The data in that column could be lost. The data in that column will be cast from `Money` to `Decimal(12,2)`.
  - You are about to drop the column `date` on the `leave_requests` table. All the data in the column will be lost.
  - You are about to drop the `customers` table. If the table is not empty, all the data it contains will be lost.
  - You are about to drop the `customers_archive` table. If the table is not empty, all the data it contains will be lost.
  - You are about to drop the `employees_archive` table. If the table is not empty, all the data it contains will be lost.
  - A unique constraint covering the columns `[employee_id,leave_type,dates]` on the table `leave_requests` will be added. If there are existing duplicate values, this will fail.
  - Added the required column `path` to the `attachment_variants` table without a default value. This is not possible if the table is not empty.

*/
-- DropForeignKey
ALTER TABLE "public"."customers" DROP CONSTRAINT "customers_user_id_fkey";

-- DropForeignKey
ALTER TABLE "public"."customers_archive" DROP CONSTRAINT "customers_archive_customer_id_fkey";

-- DropForeignKey
ALTER TABLE "public"."customers_archive" DROP CONSTRAINT "customers_archive_user_id_fkey";

-- DropForeignKey
ALTER TABLE "public"."employees_archive" DROP CONSTRAINT "employees_archive_employee_id_fkey";

-- DropForeignKey
ALTER TABLE "public"."employees_archive" DROP CONSTRAINT "employees_archive_supervisor_id_fkey";

-- DropForeignKey
ALTER TABLE "public"."employees_archive" DROP CONSTRAINT "employees_archive_user_id_fkey";

-- DropIndex
DROP INDEX "public"."leave_requests_employee_id_date_idx";

-- DropIndex
DROP INDEX "public"."leave_requests_employee_id_leave_type_date_key";

-- AlterTable
ALTER TABLE "attachment_variants" DROP COLUMN "patch",
ADD COLUMN     "path" TEXT NOT NULL;

-- AlterTable
ALTER TABLE "expenses" ALTER COLUMN "amount" DROP NOT NULL,
ALTER COLUMN "amount" SET DATA TYPE DECIMAL(12,2);

-- AlterTable
ALTER TABLE "expenses_archive" ALTER COLUMN "amount" SET DATA TYPE DECIMAL(12,2);

-- AlterTable
ALTER TABLE "leave_requests" DROP COLUMN "date",
ADD COLUMN     "dates" DATE[];

-- DropTable
DROP TABLE "public"."customers";

-- DropTable
DROP TABLE "public"."customers_archive";

-- DropTable
DROP TABLE "public"."employees_archive";

-- CreateIndex
CREATE INDEX "leave_requests_employee_id_dates_idx" ON "leave_requests"("employee_id", "dates");

-- CreateIndex
CREATE UNIQUE INDEX "leave_requests_employee_id_leave_type_dates_key" ON "leave_requests"("employee_id", "leave_type", "dates");
