Skip to content

Commit

Permalink
BoxWithImage schema changes (#363)
Browse files Browse the repository at this point in the history
  • Loading branch information
Spencer6497 authored Dec 27, 2024
1 parent 605d6df commit 7df4227
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"use strict";

/**
* what this migration is doing:
Switches existing "ImgMTextL" variant BoxWithImage instances to their new equivalents
*/

async function up(knex) {
try {
const result = await knex("components_page_box_with_images").whereNotNull('variant').update({
variant: 'M'
});
console.log(`Updated ${result.length} row(s)`);
} catch (error) {
console.log("error occured during migration. Skipping migration");
console.log(error);
}
}

module.exports = { up };
7 changes: 6 additions & 1 deletion src/components/page/box-with-image.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@
"variant": {
"type": "enumeration",
"enum": [
"ImgMTextL"
"XS",
"S",
"M",
"L",
"XL",
"XXL"
]
}
}
Expand Down
2 changes: 1 addition & 1 deletion types/generated/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ export interface PageBoxWithImage extends Struct.ComponentSchema {
image: Schema.Attribute.Media<'images' | 'files' | 'videos' | 'audios'> &
Schema.Attribute.Required;
outerBackground: Schema.Attribute.Component<'meta.background', false>;
variant: Schema.Attribute.Enumeration<['ImgMTextL']>;
variant: Schema.Attribute.Enumeration<['XS', 'S', 'M', 'L', 'XL', 'XXL']>;
};
}

Expand Down

0 comments on commit 7df4227

Please sign in to comment.