Search
ctrl/
Ask AI
Light
Dark
System

edgedb migration create

The next step after setting up the desired target schema is creating a migration script. This is done by invoking the following command:

edgedb migration create [options]

This will start an interactive tool that will provide the user with suggestions based on the differences between the current branch (or database for pre-v5) and the schema file. The prompts will look something like this:

did you create object type 'default::User'? [y,n,l,c,b,s,q,?]
?

y - confirm the prompt, use the DDL statements
n - reject the prompt
l - list the DDL statements associated with prompt
c - list already confirmed EdgeQL statements
b - revert back to previous save point, perhaps previous question
s - stop and save changes (splits migration into multiple)
q - quit without saving changes
h or ? - print help

The migration create command runs on the database it is connected to. For specifying the connection target see connection options.

--non-interactive

Do not prompt user for input. By default this works only if all the changes are “safe” unless --allow-unsafe is also specified.

--allow-unsafe

Apply the most probable unsafe changes in case there are any. This is only useful in non-interactive mode.

--allow-empty

Create a new migration even if there are no changes. This is useful for creating migration stubs for data-only migrations.

--schema-dir=schema-dir

Directory where the schema files are located. Defaults to ./dbschema.

--squash

This CLI feature is compatible with EdgeDB server 3.0 and above.

Squashes all your migrations into a single migration.