menu

EdgeDB

Bringing state-of-the-art database technology to the masses.

Channels
Team

.esdl Convention/ Best Practice

June 24, 2020 at 6:54pm

.esdl Convention/ Best Practice

June 24, 2020 at 6:54pm
When saving .esdl files I'm often tempted to include the whole CREATE MIGRATION ... to COMMIT MIGRATION;. Since EdgeDB doesn't read these files itself, they need to be send via one of the clients, at which point they're just strings. What should be the best practice here? While I like the idea of schema being a schema file (and not a schema command +/-), it's convenient. What does the EdgeDB team do and what would you recommend?

June 24, 2020 at 6:57pm
.esdl files are supposed to only contain the schema text (i.e no MIGRATION commands). We are working on the implementation of RFC 1000 which would add a reference implementation for schema management to edgedb-cli (along with the necessary command changes).
  • reply
  • like
To clarify, the intended workflow is as follows:
  1. Modify schema definition in your favorite editor.
  2. Run edgedb create-migration. This generates a migration file.
  3. Apply the migration file with edgedb migraite or read and send it with a language client: migrations are valid EdgeQL scripts.
  • reply
  • like

June 25, 2020 at 12:17pm
The migration file would have a file extension other than .esdl? The RFC doesn't indicate either way.
  • reply
  • like
The migrations would be valid EdgeQL scripts, so .edgeql.
  • reply
  • like