Modules
Every EdgeDB database can contain several modules, each with a unique name. Modules can be used to organize large schemas.
1. module default {
2. type BlogPost {
3. required property title -> str;
4. required link author -> auth::User;
5. }
6. }
8. module auth {
9. type User {
10. required property email -> str;
11. }
12. }
Modules can contain a wide range of schema elements: object types (equivalent to tables in SQL), custom scalar types, expression aliases, abstract links and properties, functions, and more. Each of these schema elements has a name; no two elements in the same module can share the same name.
You can split up your schemas however you see fit. Most users put their entire schema inside a single module called default.
Fully-qualified names
When referencing schema objects in a different module, you must use a fully-qualified name of the form module_name::object_name. In the schema above, note how BlogPost.author points to auth::User. If User and BlogPost were in the same module the auth:: prefix wouldn’t be necessary.
Standard modules
EdgeDB contains the following built-in modules which come pre-populated with useful types, functions, and operators. These are read-only modules. The contents of these modules are fully documented in Standard Library.
std: standard types, functions and other elements of the standard librarymath: algebraic and statistical functionscal: local (non-timezone-aware) and relative date/time types and functionsschema: types describing the introspection schemasys: system-wide entities, such as user roles and databasescfg: configuration and settings
