maoberlehner/storyblok-migrate

Issue with content migrations

Closed this issue · 5 comments

I have been able to get npx storyblok-migrate --component-migrations to work perfectly fine, but when i try to do the same for content migrations it doesn't seem to be doing anything.

On further inspection when I log the stories returned from the api call in services/story, I get 0 pages, but I clearly have stories on my space. I even tried hardcoding the spaceId to ensure its getting the right endpoint, same results.

Occasionally the command errors out saying "no component found for name "Root"" but there is only one file in the directory I have pointed to and it is not named root.

Any suggestions?

Hi @TylerRogers94!

Can you give me an example of one of your component definitions?

Please make sure that your component definitions hav is_root: true set.

ContentGenericAligned.js

module.exports = {
  display_name: "Generic Content - Aligned",
  is_root: true,
  is_nestable: true,
  migrations: [
    ({ content }) => {
      content.Tag = content.ContentTag;
    },
  ],
  name: "ContentGenericAligned",
  schema: {
    ContentAlignment: {
      display_name: "Text Alignment",
      type: "option",
      pos: 1,
      options: [
        { name: "Text on Left", value: "Left" },
        { name: "Text on Right", value: "Right" },
      ],
      required: false,
      default_value: "Left",
    },
    Layout: {
      display_name: "Column Layout (Image:Text)",
      type: "option",
      pos: 2,
      options: [{ name: "6:6", value: "6" }, { name: "3:9", value: "9" }],
      required: false,
      default_value: "6",
    },
    TextGroup: {
      type: "section",
      display_name: "Text",
      pos: 3,
      keys: ["Title", "Tag"],
    },
    Title: {
      display_name: "Title",
      type: "text",
      pos: 4,
    },
    Tag: {
      display_name: "Subtitle (max 30 characters)",
      type: "text",
      pos: 5,
    },
 }
};

So the contentTypes returned in runContentMigrations appear to be correct, but its returning an empty list of stories

Looks like I may have gotten it to work, thanks for your help!

That's great! Can you share what you did to solve the problem? It might help other users in the future! Thx!