Search...
ctrl/
Light
Dark
System
Sign in

Extensions

Extensions are the way Gel can be extended with more functionality. They can add new types, scalars, functions, etc., but, more importantly, they can add new ways of interacting with the database.

There are a few built-in extensions available:

To enable these extensions, add a using statement at the top level of your schema:

Copy
using extension auth;
# or / and
using extension ai;

Additionally, standalone extension packages can be installed via the CLI, with postgis being a notable example.

List installed extensions:

Copy
$ 
gel extension list
┌─────────┬─────────┐
│ Name    │ Version │
└─────────┴─────────┘

List available extensions:

Copy
$ 
gel extension list-available
┌─────────┬───────────────┐
│ Name    │ Version       │
│ postgis │ 3.4.3+6b82d77 │
└─────────┴───────────────┘

Install the postgis extension:

Copy
$ 
gel extension install -E postgis
Found extension package: postgis version 3.4.3+6b82d77
00:00:03 [====================] 22.49 MiB/22.49 MiB
Extension 'postgis' installed successfully.

Check that extension is installed:

Copy
$ 
gel extension list
┌─────────┬───────────────┐
│ Name    │ Version       │
│ postgis │ 3.4.3+6b82d77 │
└─────────┴───────────────┘

After installing extensions, make sure to restart your instance:

Copy
$ 
gel instance restart

Standalone extensions can now be declared in the schema, same as built-in extensions:

Copy
using extension postgis;

To restore a dump that uses a standalone extension, that extension must be installed before the restore process.

using extension ExtensionName ";"

Extension declaration must be outside any module block since extensions affect the entire database and not a specific module.

This section describes the low-level DDL commands for creating and dropping extensions. You typically don't need to use these commands directly, but knowing about them is useful for reviewing migrations.

Enable a particular extension for the current schema.

create extension ExtensionName ";"

The command create extension enables the specified extension for the current branch.

Enable GraphQL extension for the current schema:

Copy
create extension graphql;

Enable EdgeQL over HTTP extension for the current branch:

Copy
create extension edgeql_http;

Disable an extension.

drop extension ExtensionName ";"

The command drop extension disables a currently active extension for the current branch.

Disable GraphQL extension for the current schema:

Copy
drop extension graphql;

Disable EdgeQL over HTTP extension for the current branch:

Copy
drop extension edgeql_http;