Skip to content

Commit e5e5229

Browse files
committed
expand 'Publish Your First Extension' section
1 parent 9c17d3b commit e5e5229

File tree

1 file changed

+34
-6
lines changed

1 file changed

+34
-6
lines changed

docs/publish.md

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Before you can publish your TLE, you need to authenticate with [database.dev](https://database.dev/).
1+
Before you can publish your extension, you need to authenticate with [database.dev](https://database.dev/).
22

33
### Login to database.dev
44

@@ -14,14 +14,42 @@ If you don't have an account, [sign-up for one](https://database.dev/sign-up) on
1414

1515
You are now logged into `database.dev`.
1616

17-
### Publish TLE
17+
### Publish Your First Extension
1818

19-
A TLE has a specific [file and folder structure](extension_structure.md) for it to be valid. Make sure you have a valid TLE structure before trying to publish it.
19+
Let's create your first extension. Create a folder which will contain the extension:
2020

21-
Once you have a valid TLE, run the `dbdev publish` command to publish it. For example, to publish a TLE in the `/all_tles/my_tle` folder run the following:
21+
```
22+
mkdir my_first_tle
23+
cd my_first_tle
24+
```
25+
26+
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:
27+
28+
```sql
29+
create function greet(name text default 'world')
30+
returns text language sql
31+
as $$ select 'hello, ' || name; $$;
32+
```
33+
34+
Let's also add some docs about this extension. Create a `README.md` file and add the following content to it:
35+
36+
```
37+
The `hello_world` extension provides a `greet` function, which returns a greeting.
38+
```
39+
40+
Lastly, add a `hello_world.control` file with the following key-value pairs:
41+
42+
```
43+
default_version = 0.0.1
44+
comment = 'An extension to generate greetings'
45+
```
46+
47+
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](extension_structure.md).
48+
49+
Now run the `dbdev publish` command to publish it.
2250

2351
```
24-
dbdev publish --path /all_tles/my_tle
52+
dbdev publish --path /path/to/my_first_tle
2553
```
2654

27-
Your TLE is now published to `database.dev` and visible at `https://database.dev/<handle>/<package_name>`. Users can install it using the [dbdev in-database client](https://database.dev/installer).
55+
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](https://database.dev/installer).

0 commit comments

Comments
 (0)