Seed Data

Seed data is anything that must be loaded for an application to work properly. An application needs its seed data loaded in order to run in development, test, and production.

Examples can include:

Seed data is mostly unchanging. It typically won’t be edited in your application. But requirements can and do change, so seed data may need to be reloaded on deployed applications.

The ideal solution would be automatic: you shouldn’t have to think about it. When you start your application, your seed data should be ready

The seed data should provide integrity: for example, the created data records should work with your application validation testing.

We can create more seed data easily, for example if you want many seed users, organizations, sample data, and the like. For comparison, we have some applications with seed data for thousands of users and organizations.

Seed data should not need to be perfect in some cases. Some seed data may use random text, or "Lorem Ipsum" sample text, or blank text, just to get things in the right ballpark for our work.

Typically we add or remove seed data as new use cases come up. This helps us show that the application is working as we expect, and that the quality assurance team has valid starting data.

Seed Users

In our applications we typically have seed users with seed email addresses:

We typically have our seed script search for a seed user by email address.

If the email address exists, then our seed script decides that the user is already set up correctly.

If the email address does not exist, then our seed script creates the seed user.

If you delete a seed user, and re-run the seed script, then the script will create the seed user anew. This is to ensure that the application always has the seed users.

If you edit a seed user's email address, and re-run the seed script, then the script will create the seed user anew. This is to ensure that the application always has the seed users with the correct email addresses.

If you edit a seed user's fields (e.g. first name, last name, birth date, etc.), and re-run the seed script, then the seed script will keep your changes. This is useful for ongoing quality assurance and testing.

When you are planning the application, you can ask your developer to choose how and when the seed script will run, and which fields it will change, or keep, or recreate.

Seed Objects

In our applications we typically use seed objects for example:

We typically have our seed script search for a seed object by name.

If the name exists, then our seed script decides that the object is already set up correctly.

If the name does not exist, then our seed script creates the seed object.

If you delete a seed object, and re-run the seed script, then the script will create the seed object anew. This is to ensure that the application always has the seed objects.

If you edit a seed object's name, and re-run the seed script, then the script will create the seed object anew. This is to ensure that the application always has the seed organizations with the correct names.

If you edit a seed object's fields (e.g. company address, group members, invoice price, etc.), and re-run the seed script, then the seed script will keep your changes. This is useful for ongoing quality assurance and testing.

When you are planning the application, you can ask your developer to choose how and when the seed script will run, and which fields it will change, or keep, or recreate.

Seed Connections

In our applications we typically connect seed users to seed organizations, for example "John Doe" works at "Company 1".

If you expect to delete or edit seed data, then you can ask your application developer how to handle this.

Here are some examples that we've developed:

Seed Countries and Subcountries

In our applications we typically use seed countries and subcoutries that come from the list of international standards (ISO 3166-1 and 3166-2).

Most of the countries and subcountries are as you'd expect. There are a few that are unusual, for example Puerto Rico shows up as a country and also as a U.S. state.



What's Next?

blog comments powered by Disqus