Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

add schema

Sara Vieiraec583174a387
diff --git a/apps/designer/prisma/migrations/20220714112221_add_assets/migration.sql b/apps/designer/prisma/migrations/20220714112221_add_assets/migration.sql
new file mode 100644
index 0000000000..24b3a97e3c
--- /dev/null
+++ b/apps/designer/prisma/migrations/20220714112221_add_assets/migration.sql
@@ -0,0 +1,15 @@
+-- CreateTable
+CREATE TABLE "Asset" (
+ "id" TEXT NOT NULL,
+ "projectId" TEXT NOT NULL,
+ "type" TEXT NOT NULL,
+ "name" TEXT NOT NULL,
+ "path" TEXT NOT NULL,
+ "size" DOUBLE PRECISION NOT NULL,
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
+
+ CONSTRAINT "Asset_pkey" PRIMARY KEY ("id")
+);
+
+-- AddForeignKey
+ALTER TABLE "Asset" ADD CONSTRAINT "Asset_projectId_fkey" FOREIGN KEY ("projectId") REFERENCES "Project"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
diff --git a/apps/designer/prisma/migrations/20220714114102_remove_size/migration.sql b/apps/designer/prisma/migrations/20220714114102_remove_size/migration.sql
new file mode 100644
index 0000000000..edc101b235
--- /dev/null
+++ b/apps/designer/prisma/migrations/20220714114102_remove_size/migration.sql
@@ -0,0 +1,8 @@
+/*
+ Warnings:
+
+ - You are about to drop the column `size` on the `Asset` table. All the data in the column will be lost.
+
+*/
+-- AlterTable
+ALTER TABLE "Asset" DROP COLUMN "size";
diff --git a/apps/designer/prisma/schema.prisma b/apps/designer/prisma/schema.prisma
index c7a5edb888..26015a5835 100644
--- a/apps/designer/prisma/schema.prisma
+++ b/apps/designer/prisma/schema.prisma
@@ -13,7 +13,17 @@ datasource db {
model Team {
id String @id @default(uuid())
users User[]
+}
+model Asset {
+ id String @id @default(uuid())
+ project Project @relation(fields: [projectId], references: [id])
+ projectId String
+ type String
+ name String
+ path String
+ alt String?
+ createdAt DateTime @default(now())
}
model User {
@@ -37,6 +47,7 @@ model Project {
prodTreeIdHistory String @default("[]")
User User? @relation(fields: [userId], references: [id])
userId String?
+ Asset Asset[]
}
model Tree {
diff --git a/packages/webstudio-react-sdk/prisma/schema.prisma b/packages/webstudio-react-sdk/prisma/schema.prisma
index c7a5edb888..26015a5835 100644
--- a/packages/webstudio-react-sdk/prisma/schema.prisma
+++ b/packages/webstudio-react-sdk/prisma/schema.prisma
@@ -13,7 +13,17 @@ datasource db {
model Team {
id String @id @default(uuid())
users User[]
+}
+model Asset {
+ id String @id @default(uuid())
+ project Project @relation(fields: [projectId], references: [id])
+ projectId String
+ type String
+ name String
+ path String
+ alt String?
+ createdAt DateTime @default(now())
}
model User {
@@ -37,6 +47,7 @@ model Project {
prodTreeIdHistory String @default("[]")
User User? @relation(fields: [userId], references: [id])
userId String?
+ Asset Asset[]
}
model Tree {