/* Warnings: - The primary key for the `users` table will be changed. If it partially fails, the table could be left without primary key constraint. - You are about to drop the column `created_at` on the `users` table. All the data in the column will be lost. - You are about to drop the column `full_name` on the `users` table. All the data in the column will be lost. - You are about to drop the column `supabase_user_id` on the `users` table. All the data in the column will be lost. - You are about to drop the column `updated_at` on the `users` table. All the data in the column will be lost. - You are about to drop the `complex_users` table. If the table is not empty, all the data it contains will be lost. - Added the required column `name` to the `users` table without a default value. This is not possible if the table is not empty. - Added the required column `updatedAt` to the `users` table without a default value. This is not possible if the table is not empty. */ -- AlterEnum ALTER TYPE "ComplexUserRole" ADD VALUE 'EMPLOYEE'; -- DropForeignKey ALTER TABLE "complex_users" DROP CONSTRAINT "complex_users_complex_id_fkey"; -- DropForeignKey ALTER TABLE "complex_users" DROP CONSTRAINT "complex_users_user_id_fkey"; -- DropIndex DROP INDEX "users_supabase_user_id_key"; -- AlterTable ALTER TABLE "users" DROP CONSTRAINT "users_pkey", DROP COLUMN "created_at", DROP COLUMN "full_name", DROP COLUMN "supabase_user_id", DROP COLUMN "updated_at", ADD COLUMN "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD COLUMN "emailVerified" BOOLEAN NOT NULL DEFAULT false, ADD COLUMN "image" TEXT, ADD COLUMN "name" TEXT NOT NULL, ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL, ALTER COLUMN "id" SET DATA TYPE TEXT, ADD CONSTRAINT "users_pkey" PRIMARY KEY ("id"); -- DropTable DROP TABLE "complex_users"; -- CreateTable CREATE TABLE "sessions" ( "id" TEXT NOT NULL, "expiresAt" TIMESTAMP(3) NOT NULL, "token" TEXT NOT NULL, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "updatedAt" TIMESTAMP(3) NOT NULL, "ipAddress" TEXT, "userAgent" TEXT, "userId" TEXT NOT NULL, CONSTRAINT "sessions_pkey" PRIMARY KEY ("id") ); -- CreateTable CREATE TABLE "accounts" ( "id" TEXT NOT NULL, "accountId" TEXT NOT NULL, "providerId" TEXT NOT NULL, "userId" TEXT NOT NULL, "accessToken" TEXT, "refreshToken" TEXT, "idToken" TEXT, "accessTokenExpiresAt" TIMESTAMP(3), "refreshTokenExpiresAt" TIMESTAMP(3), "scope" TEXT, "password" TEXT, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "updatedAt" TIMESTAMP(3) NOT NULL, CONSTRAINT "accounts_pkey" PRIMARY KEY ("id") ); -- CreateTable CREATE TABLE "verification" ( "id" TEXT NOT NULL, "identifier" TEXT NOT NULL, "value" TEXT NOT NULL, "expiresAt" TIMESTAMP(3) NOT NULL, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "updatedAt" TIMESTAMP(3) NOT NULL, CONSTRAINT "verification_pkey" PRIMARY KEY ("id") ); -- CreateIndex CREATE INDEX "sessions_userId_idx" ON "sessions"("userId"); -- CreateIndex CREATE UNIQUE INDEX "sessions_token_key" ON "sessions"("token"); -- CreateIndex CREATE INDEX "accounts_userId_idx" ON "accounts"("userId"); -- CreateIndex CREATE INDEX "verification_identifier_idx" ON "verification"("identifier"); -- AddForeignKey ALTER TABLE "sessions" ADD CONSTRAINT "sessions_userId_fkey" FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "accounts" ADD CONSTRAINT "accounts_userId_fkey" FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;