Install a Package
You can install extensions available on the database.dev registry using the dbdev CLI's add
command. The dbdev client is itself an extension which you can install by following the instructions below.
Pre-requisites
Before you can install a package, ensure you have the pg_tle
extension installed in your database.
Note
If your database is running on Supabase, pg_tle
is already installed.
Warning
Restoring a logical backup of a database with a TLE installed can fail. For this reason, dbdev should only be used with databases with physical backups enabled.
1 |
|
Use
Once the prerequisites are met, you can create a migration file to install a TLE available on database.dev by running the following dbdev command:
1 |
|
For example, to install kiwicopple@pg_idkit
version 0.0.4 in extensions
schema run:
1 |
|
To create a migration file to update to the latest version of a package, you need to specify the -c
flag with the connection string to your database. The connection is used to check the current version of the package installed in the database and generate a migration file that will update it to the latest version available on database.dev.
1 |
|
kiwicopple@pg_idkit
package to the latest version, you can run:
1 |
|
Warning
To generate a correct update migration file, ensure that before running the dbdev add
command, all existing migrations in the migrations
folder have been applied to the database. The dbdev add
command looks for existing installed extensions in the database and generates a migration file that will install the TLE if it is not already installed.