Create Seed

We will create a seed file using the Nessie CLI

Create seed#

We now have a database with an empty entry table, but we won't get far without any data when we develop our application.

A seed file contains the code to add data to the database, and for Nessie, it has a lot of similarities to the migration file. For starters, we can create a seed file using Nessie. Run this command to generate a new seed file in yourdb/seeds folder:

If we now inspect the new file, we will see that it does not have a timestamp in the filename. This is because it doesn't care about the order of seeding and will run the files alphabetically usinglocaleCompare, meaning that you can prefix files with 1_... to set a seed order (if you have an idea of how to improve the ordering of seed files, feel free to join the discussion on GitHub).

 

This page is a preview of Build and deploy a REST API with Deno

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