66 lines
3.2 KiB
Markdown
66 lines
3.2 KiB
Markdown
# Migration `20201011052155-add-code-to-part`
|
|
|
|
This migration has been generated by Kurt Hutten at 10/11/2020, 4:21:55 PM.
|
|
You can check out the [state of the schema](./schema.prisma) after the migration.
|
|
|
|
## Database Steps
|
|
|
|
```sql
|
|
PRAGMA foreign_keys=OFF;
|
|
CREATE TABLE "new_Part" (
|
|
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
|
"title" TEXT NOT NULL,
|
|
"description" TEXT NOT NULL,
|
|
"code" TEXT NOT NULL DEFAULT '// Welcome to Cascade Studio! Here are some useful functions:
|
|
// Translate(), Rotate(), Scale(), Union(), Difference(), Intersection()
|
|
// Box(), Sphere(), Cylinder(), Cone(), Text3D(), Polygon()
|
|
// Offset(), Extrude(), RotatedExtrude(), Revolve(), Pipe(), Loft(),
|
|
// FilletEdges(), ChamferEdges(),
|
|
// Slider(), Button(), Checkbox()
|
|
let holeRadius = Slider("Radius", 30 , 20 , 40);
|
|
let sphere = Sphere(50);
|
|
let cylinderZ = Cylinder(holeRadius, 200, true);/nlet cylinderY = Rotate([0,1,0], 90, Cylinder(holeRadius, 200, true));
|
|
let cylinderX = Rotate([1,0,0], 90, Cylinder(holeRadius, 200, true));/nTranslate([0, 0, 50], Difference(sphere, [cylinderX, cylinderY, cylinderZ]));
|
|
|
|
Translate([-25, 0, 40], Text3D("Hi!"));/n// Don''t forget to push imported or oc-defined shapes into sceneShapes to add them to the workspace!',
|
|
"mainImage" TEXT NOT NULL,
|
|
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
);
|
|
INSERT INTO "new_Part" ("id", "title", "description", "mainImage", "createdAt") SELECT "id", "title", "description", "mainImage", "createdAt" FROM "Part";
|
|
DROP TABLE "Part";
|
|
ALTER TABLE "new_Part" RENAME TO "Part";
|
|
PRAGMA foreign_key_check;
|
|
PRAGMA foreign_keys=ON
|
|
```
|
|
|
|
## Changes
|
|
|
|
```diff
|
|
diff --git schema.prisma schema.prisma
|
|
migration 20201011043647-create-parts..20201011052155-add-code-to-part
|
|
--- datamodel.dml
|
|
+++ datamodel.dml
|
|
@@ -1,9 +1,9 @@
|
|
datasource DS {
|
|
// optionally set multiple providers
|
|
// example: provider = ["sqlite", "postgresql"]
|
|
provider = "sqlite"
|
|
- url = "***"
|
|
+ url = "***"
|
|
}
|
|
generator client {
|
|
provider = "prisma-client-js"
|
|
@@ -20,8 +20,9 @@
|
|
model Part {
|
|
id Int @id @default(autoincrement())
|
|
title String
|
|
description String // markdown string
|
|
+ code String @default("// Welcome to Cascade Studio! Here are some useful functions:\n// Translate(), Rotate(), Scale(), Union(), Difference(), Intersection()\n// Box(), Sphere(), Cylinder(), Cone(), Text3D(), Polygon()\n// Offset(), Extrude(), RotatedExtrude(), Revolve(), Pipe(), Loft(),\n// FilletEdges(), ChamferEdges(),\n// Slider(), Button(), Checkbox()\nlet holeRadius = Slider(\"Radius\", 30 , 20 , 40);\nlet sphere = Sphere(50);\nlet cylinderZ = Cylinder(holeRadius, 200, true);/nlet cylinderY = Rotate([0,1,0], 90, Cylinder(holeRadius, 200, true));\nlet cylinderX = Rotate([1,0,0], 90, Cylinder(holeRadius, 200, true));/nTranslate([0, 0, 50], Difference(sphere, [cylinderX, cylinderY, cylinderZ]));\n\nTranslate([-25, 0, 40], Text3D(\"Hi!\"));/n// Don't forget to push imported or oc-defined shapes into sceneShapes to add them to the workspace!")
|
|
mainImage String // link to cloudinary
|
|
createdAt DateTime @default(now())
|
|
// userId
|
|
//likes, comments, reactions
|
|
```
|
|
|
|
|