You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/publish.md
+34-6Lines changed: 34 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff 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/).
2
2
3
3
### Login to database.dev
4
4
@@ -14,14 +14,42 @@ If you don't have an account, [sign-up for one](https://database.dev/sign-up) on
14
14
15
15
You are now logged into `database.dev`.
16
16
17
-
### Publish TLE
17
+
### Publish Your First Extension
18
18
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:
20
20
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
+
createfunctiongreet(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.
22
50
23
51
```
24
-
dbdev publish --path /all_tles/my_tle
52
+
dbdev publish --path /path/to/my_first_tle
25
53
```
26
54
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