clean-up migrations

This commit is contained in:
Francis Cao 2023-03-14 17:43:36 -07:00
parent 9321401297
commit cfa36d1802
4 changed files with 1 additions and 16 deletions

View File

@ -82,14 +82,12 @@ CREATE TABLE `website_event` (
CREATE TABLE `team` ( CREATE TABLE `team` (
`team_id` VARCHAR(36) NOT NULL, `team_id` VARCHAR(36) NOT NULL,
`name` VARCHAR(50) NOT NULL, `name` VARCHAR(50) NOT NULL,
`user_id` VARCHAR(36) NOT NULL,
`access_code` VARCHAR(50) NULL, `access_code` VARCHAR(50) NULL,
`created_at` TIMESTAMP(0) NULL DEFAULT CURRENT_TIMESTAMP(0), `created_at` TIMESTAMP(0) NULL DEFAULT CURRENT_TIMESTAMP(0),
`updated_at` TIMESTAMP(0) NULL, `updated_at` TIMESTAMP(0) NULL,
UNIQUE INDEX `team_team_id_key`(`team_id`), UNIQUE INDEX `team_team_id_key`(`team_id`),
UNIQUE INDEX `team_access_code_key`(`access_code`), UNIQUE INDEX `team_access_code_key`(`access_code`),
INDEX `team_user_id_idx`(`user_id`),
INDEX `team_access_code_idx`(`access_code`), INDEX `team_access_code_idx`(`access_code`),
PRIMARY KEY (`team_id`) PRIMARY KEY (`team_id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
@ -113,13 +111,11 @@ CREATE TABLE `team_user` (
CREATE TABLE `team_website` ( CREATE TABLE `team_website` (
`team_website_id` VARCHAR(36) NOT NULL, `team_website_id` VARCHAR(36) NOT NULL,
`team_id` VARCHAR(36) NOT NULL, `team_id` VARCHAR(36) NOT NULL,
`user_id` VARCHAR(36) NOT NULL,
`website_id` VARCHAR(36) NOT NULL, `website_id` VARCHAR(36) NOT NULL,
`created_at` TIMESTAMP(0) NULL DEFAULT CURRENT_TIMESTAMP(0), `created_at` TIMESTAMP(0) NULL DEFAULT CURRENT_TIMESTAMP(0),
UNIQUE INDEX `team_website_team_website_id_key`(`team_website_id`), UNIQUE INDEX `team_website_team_website_id_key`(`team_website_id`),
INDEX `team_website_team_id_idx`(`team_id`), INDEX `team_website_team_id_idx`(`team_id`),
INDEX `team_website_user_id_idx`(`user_id`),
INDEX `team_website_website_id_idx`(`website_id`), INDEX `team_website_website_id_idx`(`website_id`),
PRIMARY KEY (`team_website_id`) PRIMARY KEY (`team_website_id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

View File

@ -19,7 +19,6 @@ model User {
teamUser TeamUser[] teamUser TeamUser[]
Website Website[] Website Website[]
teamWebsite TeamWebsite[]
@@map("user") @@map("user")
} }
@ -89,7 +88,6 @@ model WebsiteEvent {
model Team { model Team {
id String @id() @unique() @map("team_id") @db.VarChar(36) id String @id() @unique() @map("team_id") @db.VarChar(36)
name String @db.VarChar(50) name String @db.VarChar(50)
userId String @map("user_id") @db.VarChar(36)
accessCode String? @unique @map("access_code") @db.VarChar(50) accessCode String? @unique @map("access_code") @db.VarChar(50)
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamp(0) createdAt DateTime? @default(now()) @map("created_at") @db.Timestamp(0)
updatedAt DateTime? @map("updated_at") @db.Timestamp(0) updatedAt DateTime? @map("updated_at") @db.Timestamp(0)
@ -97,7 +95,6 @@ model Team {
teamUsers TeamUser[] teamUsers TeamUser[]
teamWebsite TeamWebsite[] teamWebsite TeamWebsite[]
@@index([userId])
@@index([accessCode]) @@index([accessCode])
@@map("team") @@map("team")
} }
@ -121,16 +118,13 @@ model TeamUser {
model TeamWebsite { model TeamWebsite {
id String @id() @unique() @map("team_website_id") @db.VarChar(36) id String @id() @unique() @map("team_website_id") @db.VarChar(36)
teamId String @map("team_id") @db.VarChar(36) teamId String @map("team_id") @db.VarChar(36)
userId String @map("user_id") @db.VarChar(36)
websiteId String @map("website_id") @db.VarChar(36) websiteId String @map("website_id") @db.VarChar(36)
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamp(0) createdAt DateTime? @default(now()) @map("created_at") @db.Timestamp(0)
team Team @relation(fields: [teamId], references: [id]) team Team @relation(fields: [teamId], references: [id])
user User @relation(fields: [userId], references: [id])
website Website @relation(fields: [websiteId], references: [id]) website Website @relation(fields: [websiteId], references: [id])
@@index([teamId]) @@index([teamId])
@@index([userId])
@@index([websiteId]) @@index([websiteId])
@@map("team_website") @@map("team_website")
} }

View File

@ -15,5 +15,4 @@ DROP INDEX "team_website_user_id_idx";
ALTER TABLE "team" DROP COLUMN "user_id"; ALTER TABLE "team" DROP COLUMN "user_id";
-- AlterTable -- AlterTable
ALTER TABLE "team_website" DROP COLUMN "user_id", ALTER TABLE "team_website" DROP COLUMN "user_id";
ADD COLUMN "userId" UUID;

View File

@ -1,15 +1,11 @@
/* /*
Warnings: Warnings:
- You are about to drop the column `userId` on the `team_website` table. All the data in the column will be lost.
- You are about to drop the column `referrer` on the `website_event` table. All the data in the column will be lost. - You are about to drop the column `referrer` on the `website_event` table. All the data in the column will be lost.
- You are about to drop the column `url` on the `website_event` table. All the data in the column will be lost. - You are about to drop the column `url` on the `website_event` table. All the data in the column will be lost.
- Added the required column `url_path` to the `website_event` table without a default value. This is not possible if the table is not empty. - Added the required column `url_path` to the `website_event` table without a default value. This is not possible if the table is not empty.
*/ */
-- AlterTable
ALTER TABLE "team_website" DROP COLUMN "userId";
-- AlterTable -- AlterTable
ALTER TABLE "website_event" DROP COLUMN "referrer", ALTER TABLE "website_event" DROP COLUMN "referrer",
DROP COLUMN "url", DROP COLUMN "url",