Publish a Package
Before you can publish your extension, you need to authenticate with database.dev.
Login to database.dev
If you don't have an account, sign-up for one on the website. Then follow the steps below:
- Make sure you are logged into the
database.dev
website. - Navigate to the Access Tokens page from the account drop-down at top right.
- Click New Token.
- Enter a token name and click Create Token.
- Copy the generated token. Note that this is the only time the token will be shown.
- On the terminal, run the
dbdev login
command. - Paste the token you copied.
You are now logged into database.dev
.
Publish Your First Extension
Let's create your first extension. Create a folder which will contain the extension:
1 2 |
|
Next create a hello_world--0.0.1.sql
file, which will contain your extension's SQL objects. Add the following function definition to this file:
1 2 3 |
|
Let's also add some docs about this extension. Create a README.md
file and add the following content to it:
1 |
|
Lastly, add a hello_world.control
file with the following key-value pairs:
1 2 |
|
Your extension is ready to publish. Its name is hello_world
and version is 0.0.1
. For details about what constitutes a valid extension, read about the Structure of an Extension.
Now run the dbdev publish
command to publish it.
1 |
|
Your extension is now published to database.dev
and visible under your account profile. You can visit your account profile from the account drop-down at the top right. Users can now install your extension using the dbdev in-database client.