EdgeDB 1.0 is launching on Feb 10th! Watch the live event.
Claim your ticket

EdgeQL includes a set of data definition language (DDL) commands that manipulate the database’s schema. DDL is the low-level equivalent to EdgeDB schema definition language. You can execute DDL commands against your database, just like any other EdgeQL query.

Copy
db> 
... 
... 
CREATE TYPE Person {
    CREATE REQUIRED PROPERTY name -> str;
};
OK: CREATE
Copy
db> 
... 
... 
... 
CREATE TYPE Movie {
    CREATE REQUIRED PROPERTY title -> str;
    CREATE REQUIRED LINK director -> Person;
};
OK: CREATE

In DDL, the order of commands is important. In the example above, you couldn’t create Movie before Person, because Movie contains a link to Person.

Under the hood, all migrations are represented as DDL scripts: a sequence of imperative commands representing the migration. When you create a migration with the CLI, EdgeDB produces a DDL script.

SDL is sort of like a 3D printer: you design the final shape and it puts it together for you. DDL is like building a house with traditional methods: to add a window, you first need a frame, to have a frame you need a wall, and so on.

DDL lets you make quick changes to your schema without creating migrations. But it can be dangerous too; some DDL commands can destroy user data permanantly. In practice, we recommend most users stick with SDL until they get comfortable, then start experimenting with DDL.

Light
Dark
System