Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Linx 98 posts 259 karma points
    Nov 27, 2021 @ 16:21
    Linx
    0

    How to seed data into a new table

    Hi

    I created a table using your guide

    https://our.umbraco.com/Documentation/Extending/Database/index-v8

    However when I use migrations in normal applications I have up/down methods to seed the data so I don't have to enter it manually.

    I don't see any documentation on Umbraco in how I do this? Could anyone advise?

    Best

    Lq

  • Markus Johansson 1945 posts 5899 karma points MVP 2x c-trib
    Nov 29, 2021 @ 23:27
    Markus Johansson
    100

    Hi!

    You could seed the data inside your migration. Basically, you could create the table and seed the data in the same migration or separate if you prefer.

    Have a look at some examples in the core source code: https://github.com/umbraco/Umbraco-CMS/tree/v9/contrib/src/Umbraco.Infrastructure/Migrations/Upgrade

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies