This video is available to students only

Seeding New Data

In this lesson, we're going to seed data for Category, Learnings and Requirements table

Seeding new data#

We have made some new migrations in the previous lessons. We want to update the database now and seed some new data in our table. Before that, we need to add Category Dbset as well, which we forgot to do in the last lecture. Let's go to the StoreContext file and copy one of them and replace it with Category and Categories.

Let's open the terminal and go to the root project, and let's delete the migration once again:

create a new one which will include the Categories table:

Finally, let's update it:

Now I would like you to copy the json files from the transcript below including the courses.json file because this time, I have added Id property to courses.json file. If I don't provide the Id, our database will create one which will be unique every time and we will have to make changes to our seeding data because the tables now have relationship with each other. You will find four json files: course.json, categories.json, learnings.json and requirements.json

Start a new discussion. All notification go to the author.