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.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
update migrations
Oleg Isonencfce0c45c440
diff --git a/mongo-migrations/breakpoints.js b/mongo-migrations/breakpoints.jsnew file mode 100644index 0000000000..bf62f2503f--- /dev/null+++ b/mongo-migrations/breakpoints.js@@ -0,0 +1,77 @@+// I am running this migration manually over console,+// because we don't have an automated setup for migrations yet.++// This converts instance.style to instance.cssRules+const migrateTree = () => {+ const transform = (instance) => {+ if (instance.style) {+ print(`migrating ${instance.id}`);+ instance.cssRules = [+ {+ breakpoint: ObjectId("626fc63909a681e2a912b5a4"),+ style: instance.style,+ },+ ];+ delete instance.style;+ }+ if (instance.children) {+ instance.children.forEach((child) => {+ transform(child);+ });+ }+ };++ const migrate = (tree) => {+ transform(tree.root);+ db.Tree.updateOne({ _id: tree._id }, { $set: { root: tree.root } });+ printjson(tree._id.toString());+ };++ const cursor = db.Tree.find();++ while (cursor.hasNext()) {+ migrate(cursor.next());+ }+};++const migrateBreakpoints = () => {+ const createBreakpoints = (projectId) => ({+ _id: projectId,+ values: [+ {+ label: "Mobile",+ minWidth: { $numberLong: "0" },+ id: ObjectId("626fc63909a681e2a912b5a4"),+ },+ {+ label: "Tablet",+ minWidth: 768,+ id: ObjectId("626fc63909a681e2a912b5a5"),+ },+ {+ label: "Laptop",+ minWidth: 1024,+ id: ObjectId("626fc63909a681e2a912b5a6"),+ },+ {+ label: "Desktop",+ minWidth: 1280,+ id: ObjectId("626fc63909a681e2a912b5a7"),+ },+ ],+ });++ const migrate = (project) => {+ print(`inserting for ${project._id}`);+ db.Breakpoints.insertOne(createBreakpoints(project._id));+ };++ const cursor = db.Project.find();++ while (cursor.hasNext()) {+ migrate(cursor.next());+ }+};++migrateBreakpoints();+migrateTree();diff --git a/mongo-migrations/style.js b/mongo-migrations/style.jsdeleted file mode 100644index 82b9a66776..0000000000--- a/mongo-migrations/style.js+++ /dev/null@@ -1,33 +0,0 @@-// I am running this migration manually over console,-// because we don't have an automated setup for migrations yet.-// This converts instance.style to instance.cssRules-const cursor = db.Tree.find();--const transform = (instance) => {- if (instance.style) {- instance.cssRules = [- {- // @todo this needs a real breakpoint- // also need to insert breakpoitns- breakpoint: "default",- style: instance.style,- },- ];- delete instance.style;- }- if (instance.children) {- instance.children.forEach((child) => {- transform(child);- });- }-};--const migrate = (tree) => {- transform(tree.root);- db.Tree.update({ _id: tree._id }, { $set: { root: tree.root } });- printjson(tree._id.toString());-};--while (cursor.hasNext()) {- migrate(cursor.next());-}