Skip to content

Commit 155437c

Browse files
committed
Document component introduction date on the website
1 parent f09f828 commit 155437c

File tree

5 files changed

+26
-8
lines changed

5 files changed

+26
-8
lines changed

examples/official-site/documentation.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ select 'text' as component,
5252
'component' as id;
5353
select description as contents from component where name = $component;
5454

55+
select 'text' as component;
56+
select 'Introduced in SQLPage v' || introduced_in_version || '.' as contents, 1 as size
57+
from component where name = $component;
58+
5559
select 'title' as component, 3 as level, 'Top-level parameters' as contents where $component IS NOT NULL;
5660
select 'card' as component, 3 AS columns where $component IS NOT NULL;
5761
select

examples/official-site/functions.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ select 'text' as component,
2828
'function' as id
2929
where $function IS NOT NULL;
3030

31+
select 'text' as component;
32+
select 'Introduced in SQLPage ' || introduced_in_version || '.' as contents, 1 as size from sqlpage_functions where name = $function;
33+
3134
SELECT description_md as contents_md FROM sqlpage_functions WHERE name = $function;
3235

3336
select 'title' as component, 3 as level, 'Parameters' as contents where $function IS NOT NULL AND EXISTS (SELECT 1 from sqlpage_function_parameters where "function" = $function);

examples/official-site/sqlpage/migrations/01_documentation.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
CREATE TABLE component(
22
name TEXT PRIMARY KEY,
33
description TEXT NOT NULL,
4-
icon TEXT -- icon name from tabler icon
4+
icon TEXT, -- icon name from tabler icon
5+
introduced_in_version TEXT
56
);
67

78
CREATE TABLE parameter(

examples/official-site/sqlpage/migrations/07_authentication.sql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
-- Insert the http_header component into the component table
2-
INSERT INTO component (name, description, icon)
2+
INSERT INTO component (name, description, icon, introduced_in_version)
33
VALUES (
44
'authentication',
55
'An advanced component that can be used to create pages with password-restricted access.
@@ -9,7 +9,8 @@ VALUES (
99
you can check the password only once and store a session token in your database.
1010
You can use the cookie component to set the session token cookie in the client browser,
1111
and then check whether the token matches what you stored in subsequent pages.',
12-
'lock'
12+
'lock',
13+
'0.7.2'
1314
);
1415
-- Insert the parameters for the http_header component into the parameter table
1516
INSERT INTO parameter (

examples/official-site/sqlpage/migrations/08_functions.sql

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ CREATE TABLE IF NOT EXISTS sqlpage_functions (
22
"name" TEXT PRIMARY KEY,
33
"icon" TEXT,
44
"description_md" TEXT,
5-
"return_type" TEXT
5+
"return_type" TEXT,
6+
"introduced_in_version" TEXT
67
);
78
CREATE TABLE IF NOT EXISTS sqlpage_function_parameters (
89
"function" TEXT REFERENCES sqlpage_functions("name"),
@@ -11,9 +12,11 @@ CREATE TABLE IF NOT EXISTS sqlpage_function_parameters (
1112
"description_md" TEXT,
1213
"type" TEXT
1314
);
14-
INSERT INTO sqlpage_functions ("name", "icon", "description_md")
15+
INSERT INTO sqlpage_functions ("name", "return_type", "introduced_in_version", "icon", "description_md")
1516
VALUES (
1617
'cookie',
18+
'TEXT',
19+
'0.7.1',
1720
'cookie',
1821
'Reads a [cookie](https://en.wikipedia.org/wiki/HTTP_cookie) with the given name from the request.
1922
Returns the value of the cookie as text, or NULL if the cookie is not present.
@@ -42,9 +45,10 @@ VALUES (
4245
'The name of the cookie to read.',
4346
'TEXT'
4447
);
45-
INSERT INTO sqlpage_functions ("name", "icon", "description_md")
48+
INSERT INTO sqlpage_functions ("name", "introduced_in_version", "icon", "description_md")
4649
VALUES (
4750
'header',
51+
'0.7.2',
4852
'heading',
4953
'Reads a [header](https://en.wikipedia.org/wiki/List_of_HTTP_header_fields) with the given name from the request.
5054
Returns the value of the header as text, or NULL if the header is not present.
@@ -72,9 +76,11 @@ VALUES (
7276
'The name of the HTTP header to read.',
7377
'TEXT'
7478
);
75-
INSERT INTO sqlpage_functions ("name", "icon", "description_md")
79+
INSERT INTO sqlpage_functions ("name", "return_type", "introduced_in_version", "icon", "description_md")
7680
VALUES (
7781
'basic_auth_username',
82+
'TEXT',
83+
'0.7.2',
7884
'user',
7985
'Returns the username from the [Basic Authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) header of the request.
8086
If the header is not present, this function raises an authorization error that will prompt the user to enter their credentials.
@@ -91,6 +97,8 @@ SELECT ''authentication'' AS component,
9197
),
9298
(
9399
'basic_auth_password',
100+
'TEXT',
101+
'0.7.2',
94102
'key',
95103
'Returns the password from the [Basic Authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) header of the request.
96104
If the header is not present, this function raises an authorization error that will prompt the user to enter their credentials.
@@ -104,9 +112,10 @@ SELECT ''authentication'' AS component,
104112
```
105113
'
106114
);
107-
INSERT INTO sqlpage_functions ("name", "icon", "description_md")
115+
INSERT INTO sqlpage_functions ("name", "introduced_in_version", "icon", "description_md")
108116
VALUES (
109117
'hash_password',
118+
'0.7.2',
110119
'spy',
111120
'Hashes a password using the [Argon2](https://en.wikipedia.org/wiki/Argon2) algorithm.
112121
The resulting hash can be stored in the database and then used with the [authentication component](documentation.sql?component=authentication#component).

0 commit comments

Comments
 (0)