Seed Data

Under Schema → Seed Data, DB Studio keeps seed definitions: the rows a reference table should hold, such as statuses, countries or feature flags. A plan compares a seed with the table on a connection and produces the script, in the engine's own language, that brings the table to the seed.

Supported Engines

Every engine, each written in its own language. The engine and database always come from the connection you plan against.

Defining a Seed

The list shows each seed's mode and row count in words, such as Upsert · 2 rows. A seed that breaks one of these rules is not saved; the message lists every problem. The rows field starts empty, with an example as its placeholder. Deleting a seed asks first; it removes only the definition, not rows already applied to a table. If the server refuses, the message names the seed and gives the reason. On a wide screen the seeds are a table you can sort by clicking a column heading, or by moving to it with Tab and pressing Enter; each press sorts ascending, then descending, then back to the original order. On a narrower screen each seed is a card with the same actions.

How a Plan Is Built

A plan reads the seed's columns from the table and matches rows by the seed's key columns. Values are compared by what they mean: JSON by its content whatever the order of its keys, dates by their day, numbers by value, and booleans also against 1 and 0. Then:

The SQL uses plain INSERT, UPDATE and DELETE statements, so the table does not need a unique key on the key columns. If the table holds a key more than once, the plan stops and names it, because an update could not tell those rows apart.

Planning and Applying

Choose Plan on a seed and pick a Connection; the picker lists only connections of an engine the seed applies to, each with its engine. If the engines cannot be loaded, Plan and the editor say so with Retry instead of offering nothing. Compute Plan counts what it would change, such as 1 to insert, 1 to update, 0 to delete, and shows the rows to insert, each row to update with its old and new values, and the rows to delete, followed by the SQL. A plan that deletes rows says so above the lists. Copy SQL copies it; Create Script saves it as a migration script for that connection, waiting for approval, which then runs through the usual approval and execution steps. The script holds the plan the server computed when you chose Create Script, and its description gives the seed, the mode and the counts.

Only an active seed can be planned; the Plan button of an inactive seed is disabled. A seed limited to some engines can only be planned against connections of those engines; planning it anywhere else is refused with the engines it applies to.

Who Can Do What

ActionRole
View seeds and plan themAny signed-in user
Create a migration script from a planAny signed-in user; approving and running it follows the usual script roles
Create, change or delete a seedRelease Manager or admin

The buttons for actions your role cannot take are not shown. The full list of routes and error codes is in the Seed Data API reference, and each error is explained under Troubleshooting.