From 77b553acf5b1ba1d121620a9f8ad140cc611f9d5 Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Thu, 6 Jan 2022 09:57:55 +0100 Subject: [PATCH] =?UTF-8?q?revert(db):=20=E2=8F=AA=EF=B8=8F=20Remove=20mig?= =?UTF-8?q?ration=20files=20and=20push=20until=20db=20is=20stable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/db/package.json | 2 +- .../migration.sql | 69 ------------------ .../migration.sql | 70 ------------------- .../migration.sql | 14 ---- .../migration.sql | 12 ---- .../20211223083710_add_theme/migration.sql | 12 ---- .../20211223124908_add_settings/migration.sql | 12 ---- .../migration.sql | 18 ----- .../migration.sql | 22 ------ .../migration.sql | 23 ------ .../migration.sql | 8 --- .../migration.sql | 22 ------ .../db/prisma/migrations/migration_lock.toml | 3 - 13 files changed, 1 insertion(+), 286 deletions(-) delete mode 100644 packages/db/prisma/migrations/20211129141723_add_next_auth_tables/migration.sql delete mode 100644 packages/db/prisma/migrations/20211206144727_add_barebones/migration.sql delete mode 100644 packages/db/prisma/migrations/20211216093901_init_graph_properites/migration.sql delete mode 100644 packages/db/prisma/migrations/20211222135449_init_answers_field_in_result/migration.sql delete mode 100644 packages/db/prisma/migrations/20211223083710_add_theme/migration.sql delete mode 100644 packages/db/prisma/migrations/20211223124908_add_settings/migration.sql delete mode 100644 packages/db/prisma/migrations/20211223141944_add_public_id/migration.sql delete mode 100644 packages/db/prisma/migrations/20211227145917_add_stripe_id/migration.sql delete mode 100644 packages/db/prisma/migrations/20211230092322_add_answer_table/migration.sql delete mode 100644 packages/db/prisma/migrations/20220103163928_remove_updated_at_on_result/migration.sql delete mode 100644 packages/db/prisma/migrations/20220106083902_normalize_data/migration.sql delete mode 100644 packages/db/prisma/migrations/migration_lock.toml diff --git a/packages/db/package.json b/packages/db/package.json index 14f7982986..9e80b3f89b 100644 --- a/packages/db/package.json +++ b/packages/db/package.json @@ -14,7 +14,7 @@ }, "scripts": { "dev": "yarn prisma db push && BROWSER=none yarn prisma studio", - "build": "prisma generate && prisma migrate deploy", + "build": "yarn migration:push", "migration:push": "dotenv -e ../../.env yarn prisma db push", "migration:create": "dotenv -e ../../.env yarn prisma migrate dev", "migration:reset": "dotenv -e ../../.env yarn prisma migrate reset" diff --git a/packages/db/prisma/migrations/20211129141723_add_next_auth_tables/migration.sql b/packages/db/prisma/migrations/20211129141723_add_next_auth_tables/migration.sql deleted file mode 100644 index 35257ab1e3..0000000000 --- a/packages/db/prisma/migrations/20211129141723_add_next_auth_tables/migration.sql +++ /dev/null @@ -1,69 +0,0 @@ --- CreateTable -CREATE TABLE "Account" ( - "id" TEXT NOT NULL, - "userId" TEXT NOT NULL, - "type" TEXT NOT NULL, - "provider" TEXT NOT NULL, - "providerAccountId" TEXT NOT NULL, - "refresh_token" TEXT, - "access_token" TEXT, - "expires_at" INTEGER, - "token_type" TEXT, - "scope" TEXT, - "id_token" TEXT, - "session_state" TEXT, - "oauth_token_secret" TEXT, - "oauth_token" TEXT, - "refresh_token_expires_in" INTEGER, - - CONSTRAINT "Account_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "Session" ( - "id" TEXT NOT NULL, - "sessionToken" TEXT NOT NULL, - "userId" TEXT NOT NULL, - "expires" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "Session_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "User" ( - "id" TEXT NOT NULL, - "name" TEXT, - "email" TEXT, - "emailVerified" TIMESTAMP(3), - "image" TEXT, - - CONSTRAINT "User_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "VerificationToken" ( - "identifier" TEXT NOT NULL, - "token" TEXT NOT NULL, - "expires" TIMESTAMP(3) NOT NULL -); - --- CreateIndex -CREATE UNIQUE INDEX "Account_provider_providerAccountId_key" ON "Account"("provider", "providerAccountId"); - --- CreateIndex -CREATE UNIQUE INDEX "Session_sessionToken_key" ON "Session"("sessionToken"); - --- CreateIndex -CREATE UNIQUE INDEX "User_email_key" ON "User"("email"); - --- CreateIndex -CREATE UNIQUE INDEX "VerificationToken_token_key" ON "VerificationToken"("token"); - --- CreateIndex -CREATE UNIQUE INDEX "VerificationToken_identifier_token_key" ON "VerificationToken"("identifier", "token"); - --- AddForeignKey -ALTER TABLE "Account" ADD CONSTRAINT "Account_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "Session" ADD CONSTRAINT "Session_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/packages/db/prisma/migrations/20211206144727_add_barebones/migration.sql b/packages/db/prisma/migrations/20211206144727_add_barebones/migration.sql deleted file mode 100644 index b937a6fb5d..0000000000 --- a/packages/db/prisma/migrations/20211206144727_add_barebones/migration.sql +++ /dev/null @@ -1,70 +0,0 @@ --- CreateEnum -CREATE TYPE "Plan" AS ENUM ('FREE', 'PRO'); - --- AlterTable -ALTER TABLE "User" ADD COLUMN "plan" "Plan" NOT NULL DEFAULT E'FREE'; - --- CreateTable -CREATE TABLE "DashboardFolder" ( - "id" TEXT NOT NULL, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "name" TEXT NOT NULL, - "ownerId" TEXT NOT NULL, - "parentFolderId" TEXT, - - CONSTRAINT "DashboardFolder_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "Typebot" ( - "id" TEXT NOT NULL, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "name" TEXT NOT NULL, - "ownerId" TEXT NOT NULL, - "publishedTypebotId" TEXT, - "folderId" TEXT, - - CONSTRAINT "Typebot_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "PublicTypebot" ( - "id" TEXT NOT NULL, - "typebotId" TEXT NOT NULL, - "steps" JSONB[], - "name" TEXT NOT NULL, - - CONSTRAINT "PublicTypebot_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "Result" ( - "id" TEXT NOT NULL, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "typebotId" TEXT NOT NULL, - - CONSTRAINT "Result_pkey" PRIMARY KEY ("id") -); - --- CreateIndex -CREATE UNIQUE INDEX "PublicTypebot_typebotId_key" ON "PublicTypebot"("typebotId"); - --- AddForeignKey -ALTER TABLE "DashboardFolder" ADD CONSTRAINT "DashboardFolder_ownerId_fkey" FOREIGN KEY ("ownerId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "DashboardFolder" ADD CONSTRAINT "DashboardFolder_parentFolderId_fkey" FOREIGN KEY ("parentFolderId") REFERENCES "DashboardFolder"("id") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "Typebot" ADD CONSTRAINT "Typebot_ownerId_fkey" FOREIGN KEY ("ownerId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "Typebot" ADD CONSTRAINT "Typebot_folderId_fkey" FOREIGN KEY ("folderId") REFERENCES "DashboardFolder"("id") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "PublicTypebot" ADD CONSTRAINT "PublicTypebot_typebotId_fkey" FOREIGN KEY ("typebotId") REFERENCES "Typebot"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "Result" ADD CONSTRAINT "Result_typebotId_fkey" FOREIGN KEY ("typebotId") REFERENCES "Typebot"("id") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/packages/db/prisma/migrations/20211216093901_init_graph_properites/migration.sql b/packages/db/prisma/migrations/20211216093901_init_graph_properites/migration.sql deleted file mode 100644 index 9433e270ee..0000000000 --- a/packages/db/prisma/migrations/20211216093901_init_graph_properites/migration.sql +++ /dev/null @@ -1,14 +0,0 @@ -/* - Warnings: - - - Added the required column `startBlock` to the `PublicTypebot` table without a default value. This is not possible if the table is not empty. - - Added the required column `startBlock` to the `Typebot` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "PublicTypebot" ADD COLUMN "blocks" JSONB[], -ADD COLUMN "startBlock" JSONB NOT NULL; - --- AlterTable -ALTER TABLE "Typebot" ADD COLUMN "blocks" JSONB[], -ADD COLUMN "startBlock" JSONB NOT NULL; diff --git a/packages/db/prisma/migrations/20211222135449_init_answers_field_in_result/migration.sql b/packages/db/prisma/migrations/20211222135449_init_answers_field_in_result/migration.sql deleted file mode 100644 index 70776c5729..0000000000 --- a/packages/db/prisma/migrations/20211222135449_init_answers_field_in_result/migration.sql +++ /dev/null @@ -1,12 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `steps` on the `PublicTypebot` table. All the data in the column will be lost. - -*/ --- AlterTable -ALTER TABLE "PublicTypebot" DROP COLUMN "steps"; - --- AlterTable -ALTER TABLE "Result" ADD COLUMN "answers" JSONB[], -ADD COLUMN "isCompleted" BOOLEAN; diff --git a/packages/db/prisma/migrations/20211223083710_add_theme/migration.sql b/packages/db/prisma/migrations/20211223083710_add_theme/migration.sql deleted file mode 100644 index 8b38c3beb3..0000000000 --- a/packages/db/prisma/migrations/20211223083710_add_theme/migration.sql +++ /dev/null @@ -1,12 +0,0 @@ -/* - Warnings: - - - Added the required column `theme` to the `PublicTypebot` table without a default value. This is not possible if the table is not empty. - - Added the required column `theme` to the `Typebot` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "PublicTypebot" ADD COLUMN "theme" JSONB NOT NULL; - --- AlterTable -ALTER TABLE "Typebot" ADD COLUMN "theme" JSONB NOT NULL; diff --git a/packages/db/prisma/migrations/20211223124908_add_settings/migration.sql b/packages/db/prisma/migrations/20211223124908_add_settings/migration.sql deleted file mode 100644 index fb3f6f55cd..0000000000 --- a/packages/db/prisma/migrations/20211223124908_add_settings/migration.sql +++ /dev/null @@ -1,12 +0,0 @@ -/* - Warnings: - - - Added the required column `settings` to the `PublicTypebot` table without a default value. This is not possible if the table is not empty. - - Added the required column `settings` to the `Typebot` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "PublicTypebot" ADD COLUMN "settings" JSONB NOT NULL; - --- AlterTable -ALTER TABLE "Typebot" ADD COLUMN "settings" JSONB NOT NULL; diff --git a/packages/db/prisma/migrations/20211223141944_add_public_id/migration.sql b/packages/db/prisma/migrations/20211223141944_add_public_id/migration.sql deleted file mode 100644 index fa9b4cea62..0000000000 --- a/packages/db/prisma/migrations/20211223141944_add_public_id/migration.sql +++ /dev/null @@ -1,18 +0,0 @@ -/* - Warnings: - - - A unique constraint covering the columns `[publicId]` on the table `PublicTypebot` will be added. If there are existing duplicate values, this will fail. - - A unique constraint covering the columns `[publicId]` on the table `Typebot` will be added. If there are existing duplicate values, this will fail. - -*/ --- AlterTable -ALTER TABLE "PublicTypebot" ADD COLUMN "publicId" TEXT; - --- AlterTable -ALTER TABLE "Typebot" ADD COLUMN "publicId" TEXT; - --- CreateIndex -CREATE UNIQUE INDEX "PublicTypebot_publicId_key" ON "PublicTypebot"("publicId"); - --- CreateIndex -CREATE UNIQUE INDEX "Typebot_publicId_key" ON "Typebot"("publicId"); diff --git a/packages/db/prisma/migrations/20211227145917_add_stripe_id/migration.sql b/packages/db/prisma/migrations/20211227145917_add_stripe_id/migration.sql deleted file mode 100644 index dc15cb80f6..0000000000 --- a/packages/db/prisma/migrations/20211227145917_add_stripe_id/migration.sql +++ /dev/null @@ -1,22 +0,0 @@ -/* - Warnings: - - - A unique constraint covering the columns `[stripeId]` on the table `User` will be added. If there are existing duplicate values, this will fail. - -*/ --- AlterEnum --- This migration adds more than one value to an enum. --- With PostgreSQL versions 11 and earlier, this is not possible --- in a single migration. This can be worked around by creating --- multiple migrations, each migration adding only one value to --- the enum. - - -ALTER TYPE "Plan" ADD VALUE 'LIFETIME'; -ALTER TYPE "Plan" ADD VALUE 'OFFERED'; - --- AlterTable -ALTER TABLE "User" ADD COLUMN "stripeId" TEXT; - --- CreateIndex -CREATE UNIQUE INDEX "User_stripeId_key" ON "User"("stripeId"); diff --git a/packages/db/prisma/migrations/20211230092322_add_answer_table/migration.sql b/packages/db/prisma/migrations/20211230092322_add_answer_table/migration.sql deleted file mode 100644 index a2102a639b..0000000000 --- a/packages/db/prisma/migrations/20211230092322_add_answer_table/migration.sql +++ /dev/null @@ -1,23 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `answers` on the `Result` table. All the data in the column will be lost. - -*/ --- AlterTable -ALTER TABLE "Result" DROP COLUMN "answers"; - --- CreateTable -CREATE TABLE "Answer" ( - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "resultId" TEXT NOT NULL, - "stepId" TEXT NOT NULL, - "blockId" TEXT NOT NULL, - "content" TEXT NOT NULL -); - --- CreateIndex -CREATE UNIQUE INDEX "Answer_resultId_blockId_stepId_key" ON "Answer"("resultId", "blockId", "stepId"); - --- AddForeignKey -ALTER TABLE "Answer" ADD CONSTRAINT "Answer_resultId_fkey" FOREIGN KEY ("resultId") REFERENCES "Result"("id") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/packages/db/prisma/migrations/20220103163928_remove_updated_at_on_result/migration.sql b/packages/db/prisma/migrations/20220103163928_remove_updated_at_on_result/migration.sql deleted file mode 100644 index a66fc94d4e..0000000000 --- a/packages/db/prisma/migrations/20220103163928_remove_updated_at_on_result/migration.sql +++ /dev/null @@ -1,8 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `updatedAt` on the `Result` table. All the data in the column will be lost. - -*/ --- AlterTable -ALTER TABLE "Result" DROP COLUMN "updatedAt"; diff --git a/packages/db/prisma/migrations/20220106083902_normalize_data/migration.sql b/packages/db/prisma/migrations/20220106083902_normalize_data/migration.sql deleted file mode 100644 index b5eea41fa2..0000000000 --- a/packages/db/prisma/migrations/20220106083902_normalize_data/migration.sql +++ /dev/null @@ -1,22 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `startBlock` on the `PublicTypebot` table. All the data in the column will be lost. - - You are about to drop the column `startBlock` on the `Typebot` table. All the data in the column will be lost. - - Added the required column `steps` to the `PublicTypebot` table without a default value. This is not possible if the table is not empty. - - Changed the type of `blocks` on the `PublicTypebot` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. - - Added the required column `steps` to the `Typebot` table without a default value. This is not possible if the table is not empty. - - Changed the type of `blocks` on the `Typebot` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. - -*/ --- AlterTable -ALTER TABLE "PublicTypebot" DROP COLUMN "startBlock", -ADD COLUMN "steps" JSONB NOT NULL, -DROP COLUMN "blocks", -ADD COLUMN "blocks" JSONB NOT NULL; - --- AlterTable -ALTER TABLE "Typebot" DROP COLUMN "startBlock", -ADD COLUMN "steps" JSONB NOT NULL, -DROP COLUMN "blocks", -ADD COLUMN "blocks" JSONB NOT NULL; diff --git a/packages/db/prisma/migrations/migration_lock.toml b/packages/db/prisma/migrations/migration_lock.toml deleted file mode 100644 index fbffa92c2b..0000000000 --- a/packages/db/prisma/migrations/migration_lock.toml +++ /dev/null @@ -1,3 +0,0 @@ -# Please do not edit this file manually -# It should be added in your version-control system (i.e. Git) -provider = "postgresql" \ No newline at end of file