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

One of EdgeDB’s foundational features is declarative schema modeling.

EdgeDB schemas are declared using SDL (EdgeDB Schema Definition Language). SDL’s declarative, object-oriented syntax will look familiar to users of ORM libraries.

Copy
type Movie {
  required property title -> str;
  required link director -> Person;
}

type Person {
  required property name -> str;
}

SDL has two important properties. First, it’s declarative; you can just write your schema down exactly as you want it to be. It’s easy to see the entire state of your schema at a glance.

Secondly, it’s object-oriented. There are no foreign keys; instead, relationships between types are directly represented with Links; this is part of what makes deep EdgeQL queries so concise. For example:

Copy
SELECT Movie {
  title,
  director: {
    name
  }
}

Your schema should be defined in one or more .esdl files. These files should be placed in a directory called dbschema in the root of your project.

Syntax highlighter packages/extensions for .esdl files are available for Visual Studio Code, Sublime Text, Atom, and Vim.

EdgeDB’s baked-in migration system lets you painlessly evolve your schema throughout the development process. After modifying your .esdl files, you can create and apply a migration with the EdgeDB command-line tool. For a full guide on how migrations work, reference the Creating and applying migrations guide.

A migration consists of a sequence of imperative schema-modifying commands like CREATE TYPE, ALTER PROPERTY, etc. Collectively these commands are known as DDL (data definition language). We recommend that most users use SDL and migrations when building applications. However, if you prefer SQL-style imperative schema modeling, you are free to use DDL directly; go to Reference > DDL to learn more.

Light
Dark
System