From 7ec8e351fdd17c4a63c2db76b0e1258a1ea5ea11 Mon Sep 17 00:00:00 2001 From: Roman Pominov Date: Mon, 5 Sep 2022 14:49:58 +0300 Subject: [PATCH 1/3] add a "migrations:deploy" script --- apps/designer/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/designer/package.json b/apps/designer/package.json index c7ffe52ce0..615618ed94 100644 --- a/apps/designer/package.json +++ b/apps/designer/package.json @@ -14,7 +14,8 @@ "prettier": "prettier \"*.{js,md,json,ts}\" \"{docs,app}/**/*.{js,md,json,ts}\"", "storybook:run": "start-storybook -p 6006", "storybook:build": "build-storybook", - "migrations": "migrations --dev" + "migrations": "migrations --dev", + "migrations:deploy": "migrations migrate" }, "dependencies": { "@lexical/react": "^0.3.5", From 63cd5e2df0772fb1d55700e8789902f06ed9fad0 Mon Sep 17 00:00:00 2001 From: Roman Pominov Date: Mon, 5 Sep 2022 15:36:29 +0300 Subject: [PATCH 2/3] add a noop migration --- .../20220905153337_noop/migration.ts | 11 +++ .../20220905153337_noop/schema.prisma | 83 +++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 packages/prisma-client/prisma/migrations/20220905153337_noop/migration.ts create mode 100644 packages/prisma-client/prisma/migrations/20220905153337_noop/schema.prisma diff --git a/packages/prisma-client/prisma/migrations/20220905153337_noop/migration.ts b/packages/prisma-client/prisma/migrations/20220905153337_noop/migration.ts new file mode 100644 index 0000000000..6d8fead3b5 --- /dev/null +++ b/packages/prisma-client/prisma/migrations/20220905153337_noop/migration.ts @@ -0,0 +1,11 @@ +import { PrismaClient } from "./client"; + +export default () => { + const client = new PrismaClient(); + return client.$transaction(async (prisma) => { + const usersCount = await prisma.user.count(); + + // eslint-disable-next-line no-console + console.log("Example noop migration test", { usersCount }); + }); +}; diff --git a/packages/prisma-client/prisma/migrations/20220905153337_noop/schema.prisma b/packages/prisma-client/prisma/migrations/20220905153337_noop/schema.prisma new file mode 100644 index 0000000000..05761a9e1f --- /dev/null +++ b/packages/prisma-client/prisma/migrations/20220905153337_noop/schema.prisma @@ -0,0 +1,83 @@ +// DO NOT EDIT THIS FILE! +// This a copy of your schema.prisma that corresponds to the state of the database +// when all migrations up until this one are applied. +// It's used to generate a Prisma Client for the migration. + +// This is your Prisma schema file, +// learn more about it in the docs: https://pris.ly/d/prisma-schema + +generator client { + provider = "prisma-client-js" + previewFeatures = ["interactiveTransactions"] + output = "client" +} + +datasource db { + provider = "postgres" + url = env("DATABASE_URL") +} + +model Team { + id String @id @default(uuid()) + users User[] +} + +enum Location { + FS + REMOTE +} + +model Asset { + id String @id @default(uuid()) + project Project @relation(fields: [projectId], references: [id]) + projectId String + format String? + size Int + width Decimal? + height Decimal? + name String + alt String? + location Location + createdAt DateTime @default(now()) +} + +model User { + id String @id @default(uuid()) + email String? @unique + provider String? + image String? + username String? + createdAt DateTime @default(now()) + team Team? @relation(fields: [teamId], references: [id]) + teamId String? + projects Project[] +} + +model Project { + id String @id @default(uuid()) + title String + domain String @unique + prodTreeId String? // exists when published + devTreeId String + prodTreeIdHistory String @default("[]") + user User? @relation(fields: [userId], references: [id]) + userId String? + assets Asset[] +} + +model Tree { + id String @id @default(uuid()) + root String +} + +model InstanceProps { + id String @id @default(uuid()) + instanceId String + treeId String + props String @default("[]") +} + +model Breakpoints { + treeId String @id @default(uuid()) + values String @default("[]") +} From c84b0d0cd1c0eaa1df6786b428a23fe69280e6c5 Mon Sep 17 00:00:00 2001 From: Roman Pominov Date: Mon, 5 Sep 2022 16:06:08 +0300 Subject: [PATCH 3/3] fix build --- apps/designer/app/designer/designer.tsx | 1 - apps/designer/app/designer/features/topbar/topbar.tsx | 1 - 2 files changed, 2 deletions(-) diff --git a/apps/designer/app/designer/designer.tsx b/apps/designer/app/designer/designer.tsx index e29bd7aa0f..b3f7193d16 100644 --- a/apps/designer/app/designer/designer.tsx +++ b/apps/designer/app/designer/designer.tsx @@ -33,7 +33,6 @@ import { import { useClientSettings } from "./shared/client-settings"; import { Navigator } from "./features/sidebar-left"; import { PANEL_WIDTH } from "./shared/constants"; -import { Asset } from "@webstudio-is/asset-uploader"; export const links = () => { return [ diff --git a/apps/designer/app/designer/features/topbar/topbar.tsx b/apps/designer/app/designer/features/topbar/topbar.tsx index 86bc0c2915..f7125f59aa 100644 --- a/apps/designer/app/designer/features/topbar/topbar.tsx +++ b/apps/designer/app/designer/features/topbar/topbar.tsx @@ -1,5 +1,4 @@ import type { Publish } from "~/shared/pubsub"; -import type { Project } from "@webstudio-is/prisma-client"; import { darkTheme, Flex, type CSS } from "@webstudio-is/design-system"; import type { Config } from "~/config"; import { PreviewButton } from "./preview";