pgkiln 0.47.0 → 0.49.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/SECURITY.md +2 -2
- package/db/migrations/109_builder_pins.sql +19 -0
- package/db/migrations/110_sql_charts.sql +23 -0
- package/db/migrations/111_sql_diagram.sql +24 -0
- package/db/migrations/113_rest_objects.sql +49 -0
- package/db/migrations/116_dump_jobs.sql +41 -0
- package/db/migrations/117_rest_handlers.sql +63 -0
- package/db/migrations/118_change_log.sql +54 -0
- package/docs/apex-feature-parity.md +11 -11
- package/docs/guide/01-installation.md +4 -0
- package/docs/guide/03-builder.md +267 -7
- package/docs/guide/08-security.md +29 -0
- package/docs/guide/12-development.md +70 -6
- package/docs/guide/13-rest-api.md +133 -10
- package/docs/guide/15-extensions.md +1 -1
- package/examples/hr/hr_62_rest_module.sql +39 -0
- package/package.json +1 -1
- package/public/app.css +1 -1
- package/public/builder-icons.svg +2 -0
- package/public/builder.css +442 -173
- package/public/builder.js +48 -0
- package/public/data-modeler.css +56 -0
- package/public/data-modeler.js +367 -0
- package/public/palette.js +133 -0
- package/public/sql-monitor.js +73 -0
- package/public/worksheet.css +49 -0
- package/public/worksheet.js +4 -0
- package/src/app.ts +10 -0
- package/src/automations.ts +6 -0
- package/src/binds.ts +2 -1
- package/src/builder/advisor.ts +24 -2
- package/src/builder/autorest.ts +363 -0
- package/src/builder/changelog.ts +240 -0
- package/src/builder/components.ts +1 -1
- package/src/builder/data-modeler.ts +382 -0
- package/src/builder/datapump.ts +364 -0
- package/src/builder/db-users.ts +472 -0
- package/src/builder/ddl-tools.ts +13 -4
- package/src/builder/find-workspace.ts +2 -2
- package/src/builder/launchpad.ts +140 -0
- package/src/builder/object-actions.ts +1 -0
- package/src/builder/object-browser.ts +7 -1
- package/src/builder/plan-view.ts +25 -0
- package/src/builder/rest-modules.ts +629 -0
- package/src/builder/rest.ts +1 -0
- package/src/builder/routes.ts +4 -2
- package/src/builder/scheduling.ts +495 -0
- package/src/builder/sql-charts.ts +203 -0
- package/src/builder/sql-monitor.ts +397 -0
- package/src/builder/sql-tools.ts +53 -0
- package/src/builder/sql-utilities.ts +7 -39
- package/src/builder/sql.ts +20 -9
- package/src/builder/table-editor.ts +4 -1
- package/src/builder/top-sql.ts +24 -6
- package/src/builder/ui.ts +25 -17
- package/src/builder/worksheet.ts +35 -28
- package/src/builder/workspaces.ts +4 -2
- package/src/changelog.ts +109 -0
- package/src/cli/replace.ts +3 -1
- package/src/cron-schedule.ts +282 -0
- package/src/datamodel.ts +324 -0
- package/src/datapump.ts +546 -0
- package/src/dbroles.ts +215 -0
- package/src/dumpscript.ts +407 -0
- package/src/pgcron.ts +225 -0
- package/src/runtime/autorest.ts +336 -0
- package/src/runtime/rest-handlers.ts +75 -0
- package/src/runtime/rest.ts +120 -26
- package/src/session.ts +2 -0
package/docs/guide/03-builder.md
CHANGED
|
@@ -102,7 +102,41 @@ Links), added on the workspace's page by administrators and the workspace's admi
|
|
|
102
102
|
`https://` URL, an optional description and an order. While the workspace is current an **Extensions** icon in the
|
|
103
103
|
rail opens them, each in a new tab (`rel="noopener noreferrer"`).
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
#### Scheduling with pg_cron
|
|
106
|
+
|
|
107
|
+
(sprint 101; Database Actions: Scheduling) **SQL Workshop → Scheduling** (administrators only) manages the jobs of
|
|
108
|
+
[pg_cron](https://github.com/citusdata/pg_cron), the PostgreSQL extension that runs SQL on a schedule inside the
|
|
109
|
+
database server. pgkiln needs pg_cron 1.4 or later, created in pgkiln's database; the page says what is missing when
|
|
110
|
+
it isn't (the package, `shared_preload_libraries = 'pg_cron'`, `cron.database_name`, `create extension pg_cron`).
|
|
111
|
+
Without pg_cron it lists **pgkiln's own scheduled work** read-only: every application's automations (Shared Components
|
|
112
|
+
→ Automations, [chapter 6](06-processing.md)) with their schedule, next and last run, and the latest background process
|
|
113
|
+
jobs. With pg_cron that list is behind a toggle under the jobs.
|
|
114
|
+
|
|
115
|
+
- **Jobs** (`cron.job`): name, the command, the schedule with its meaning in words (*At 02:00, every day*), the **next
|
|
116
|
+
run**, the last run's status and time (and how many of the last ten failed), database and the role it runs as;
|
|
117
|
+
a search field. Times are in pg_cron's time zone (`cron.timezone`, GMT unless set). pg_cron shows each role only its
|
|
118
|
+
own jobs: when pgkiln's owner connection is neither a superuser nor `BYPASSRLS`, the page says so.
|
|
119
|
+
- **Create job** / **Edit**: name (unique per role), database, *Run as* (a role that can sign in; only a superuser
|
|
120
|
+
schedules for another role), *Active*, the command (SQL, run outside a transaction block as pg_cron runs it, so
|
|
121
|
+
`vacuum` works) and the **schedule**: five cron fields, `n seconds` (1 to 59) or `@hourly` … `@yearly`, `@reboot`.
|
|
122
|
+
A **schedule builder** (one field each for minute, hour, day of month, month and day of week, `$` for the last day
|
|
123
|
+
of the month) and **common schedules** fill it in; the **preview** shows it in words with the **next five runs**,
|
|
124
|
+
as you type (without JavaScript: the *Use* and *Preview* buttons). pgkiln explains schedules as pg_cron reads them:
|
|
125
|
+
lists, ranges, steps, month and day names, 7 for Sunday, and a day matching either the day of month or the day of
|
|
126
|
+
week when both are restricted.
|
|
127
|
+
- **Review SQL** shows the statements (`cron.schedule_in_database`, `cron.alter_job` with only what changed, an
|
|
128
|
+
`update cron.job` for a new name; the command dollar-quoted); **Apply** runs them in one transaction and only if they
|
|
129
|
+
are still what was reviewed. **Disable / Enable** (`cron.alter_job(…, active := …)`) applies at once and shows the
|
|
130
|
+
statement; **Unschedule…** (`cron.unschedule`) after a review. Every change goes to the activity log (event `cron_job`).
|
|
131
|
+
- **Run now**: pg_cron has no run-now, so pgkiln runs the job's stored command once itself: a new connection to the
|
|
132
|
+
job's database with the owner connection's login, `SET ROLE` to the job's role (the owner must be allowed to), no
|
|
133
|
+
transaction block around it, a 10-minute statement timeout. The page shows the result, the duration and notices.
|
|
134
|
+
The run is not in pg_cron's history; the activity log has it (event `cron_run_now`).
|
|
135
|
+
- **Run history** (`cron.job_run_details`, newest first, 200 at most): status, start, duration and message, filtered
|
|
136
|
+
by job, status or a text in the message or command. **Purge…** deletes runs older than 7, 30 or 90 days, or all
|
|
137
|
+
(of every job or one), after showing the `delete` and how many runs it removes: pg_cron keeps every run until then.
|
|
138
|
+
|
|
139
|
+
## Export and import
|
|
106
140
|
|
|
107
141
|
Workspace utilities → **Export and import** (`/builder/workspace-export`; APEX: Workspace Utilities → Export), for
|
|
108
142
|
administrators and the workspace's administrators: the current workspace's components as one JSON file (format
|
|
@@ -183,7 +217,7 @@ Every builder page has the same frame, modelled on an IDE:
|
|
|
183
217
|
pages of an application); at the bottom the **Administration** menu (Workspace utilities; for administrators of the
|
|
184
218
|
current workspace *Manage service*: [workspace message and environment banner](#workspace-message-and-environment-banner),
|
|
185
219
|
[workspace utilization](#workspace-utilization) and the workspace's page; Manage users and groups, Developers,
|
|
186
|
-
Monitor activity, Change my password), Help, and your account menu (the circle with your initials) with the
|
|
220
|
+
Monitor activity, [Database users](#database-users) for administrators, Change my password), Help, and your account menu (the circle with your initials) with the
|
|
187
221
|
**builder theme** (*Dark*, the default; *Light*; or *System*, which follows the operating system),
|
|
188
222
|
Change password and Sign out. The theme is remembered on this device, also after signing out;
|
|
189
223
|
it only changes the builder, not your applications.
|
|
@@ -199,6 +233,13 @@ Every builder page has the same frame, modelled on an IDE:
|
|
|
199
233
|
|
|
200
234
|
On phones the rail gets narrower and the breadcrumb shows only the current page.
|
|
201
235
|
|
|
236
|
+
The builder's look comes from design tokens at the top of `public/builder.css` (sprint 105): CSS custom properties
|
|
237
|
+
for colours (a warm neutral palette with the kiln's ember for primary buttons, links, focus rings and selections),
|
|
238
|
+
surfaces and their shadows, corner radii, the type scale and transitions, in a light and a dark set. The rail, the
|
|
239
|
+
toolbar and the status bar stay dark in both themes. Transitions are switched off when the operating system asks
|
|
240
|
+
for reduced motion. The builder uses the system's fonts (Inter when it is installed); it loads nothing from
|
|
241
|
+
other sites.
|
|
242
|
+
|
|
202
243
|
(sprint 86) An address under `/builder` that leads nowhere (a deleted application or page, a typo, an
|
|
203
244
|
application of a workspace you are not a member of) shows a **Page not found** page in the builder's
|
|
204
245
|
theme with a link to the App Builder home; a server error shows **Something went wrong** (the error
|
|
@@ -1254,7 +1295,18 @@ session's **schema** (APEX: the default schema): it goes first in the search pat
|
|
|
1254
1295
|
you sign out. Tasks link to Quick SQL, blueprints, table descriptions, sample data and Generate DDL.
|
|
1255
1296
|
|
|
1256
1297
|
(sprint 75) The tools are tabs: Home, SQL Worksheet, Object Browser, SQL Scripts and Utilities; **More** opens the
|
|
1257
|
-
others (Quick SQL, Query Builder, Load and Unload Data, Sample Data, DDL, Compare, AI), and the open one is a tab too.
|
|
1298
|
+
others (Quick SQL, Query Builder, Load and Unload Data, Sample Data, DDL, Compare, Data Modeler, AI), and the open one is a tab too.
|
|
1299
|
+
|
|
1300
|
+
(sprint 96; Database Actions: the Launchpad) The home page starts with **Pinned & recently visited**: the pages you
|
|
1301
|
+
pinned (a tool, a database object from the Object Browser, a saved worksheet from its file menu; at most 24, per
|
|
1302
|
+
workspace) and the SQL Workshop pages you opened last in this browser. Below, the tools are in three tabs,
|
|
1303
|
+
**Development**, **Administration** and **Monitoring**, each with a line about what it does and a pin; the **More**
|
|
1304
|
+
menu uses the same headings.
|
|
1305
|
+
|
|
1306
|
+
**Search** (**Ctrl/Cmd + K** on any builder page, or the field in the header) finds tools, applications, pages
|
|
1307
|
+
(by name or number) and database objects (tables, views, materialized views, functions and procedures) by name;
|
|
1308
|
+
the arrow keys and Enter open one. Applications and pages come from your workspace only; objects from the schemas
|
|
1309
|
+
the SQL Workshop's connection may use. Without JavaScript the header's field opens a page of results.
|
|
1258
1310
|
|
|
1259
1311
|
- **SQL Worksheet** (`/builder/sql/worksheet`, sprint 91; Database Actions: SQL; was SQL Commands, whose address
|
|
1260
1312
|
`/builder/sql/commands` opens the same page): one screen with a **navigator** on the left, the **editor** with a
|
|
@@ -1271,6 +1323,8 @@ others (Quick SQL, Query Builder, Load and Unload Data, Sample Data, DDL, Compar
|
|
|
1271
1323
|
function and the trigger) and **Add policy** (row level security on, a policy to fill in); **Drop…** writes the
|
|
1272
1324
|
DROP statement with a comment that lists what depends on the object (views, foreign keys…). Nothing runs: you
|
|
1273
1325
|
review the statement and run it.
|
|
1326
|
+
(sprint 100) Tables and views also have **REST › Enable / Disable**: it opens the object's page in **RESTful
|
|
1327
|
+
Services** when it is published, or the Enable form for it (below).
|
|
1274
1328
|
- (sprint 95) **Table Properties** (a table's **Edit…**, **Use as template**, the Object Browser's *Edit table* and
|
|
1275
1329
|
its *Table (form)* tile): a form with **Columns** (name, type, primary key, not null, default, identity,
|
|
1276
1330
|
comment; move them up or down for a new table, remove them), **Unique keys**, **Foreign keys** (the table it refers
|
|
@@ -1299,6 +1353,12 @@ others (Quick SQL, Query Builder, Load and Unload Data, Sample Data, DDL, Compar
|
|
|
1299
1353
|
width, and the step's conditions (filter, index and join conditions, sort keys). Autotrace adds the actual time,
|
|
1300
1354
|
rows, loops and buffers, the time spent in the step itself, marks the **slowest step**, and flags estimates that
|
|
1301
1355
|
are 10 times too high or too low (run `ANALYZE` on the table). **Text plan** shows it like psql.
|
|
1356
|
+
- (sprint 97) **Chart** (**Ctrl + F11**, or *Chart* above the Query Result) draws the last query with pgkiln's
|
|
1357
|
+
own charts: the first text or date column gives the labels, the number columns the values; change the type (bar,
|
|
1358
|
+
column, stacked bar, line, area, donut, pie, scatter), the label column or the values and it draws again. Name it
|
|
1359
|
+
and **Save chart**: SQL Workshop → **Charts** lists the saved charts (shared by the workspace) and draws the ones
|
|
1360
|
+
on its dashboard; a chart's page changes its settings, opens its query in the worksheet or deletes it. A saved
|
|
1361
|
+
chart's SELECT runs read-only with a 10 second timeout and at most 500 rows.
|
|
1302
1362
|
- **Notices** lists the `RAISE NOTICE`, `INFO` and `WARNING` messages of the last run with their time.
|
|
1303
1363
|
**SQL History** (sprint 92) lists your last 200 statements in this workspace with how they ended, their rows and
|
|
1304
1364
|
time; running the same statement again counts on its row (*3×*). Search it, show only the ones that failed or
|
|
@@ -1383,6 +1443,27 @@ others (Quick SQL, Query Builder, Load and Unload Data, Sample Data, DDL, Compar
|
|
|
1383
1443
|
The state is in the URL (tables in the order chosen, joins, functions and the tables' places), so
|
|
1384
1444
|
a query can be bookmarked; everything except dragging works without JavaScript. Only names from
|
|
1385
1445
|
the catalog and the fixed functions are used, and condition values are string literals.
|
|
1446
|
+
- **Data Modeler** (SQL Workshop → More → Data Modeler, `/builder/sql/modeler`): named relational
|
|
1447
|
+
**diagrams** of a schema's tables and views, kept per workspace and shared by its developers. Create
|
|
1448
|
+
one with a name, a schema and, optionally, the objects (`orders, customers`, `ord*`, or `*` for all);
|
|
1449
|
+
**Add objects to diagram** searches the schema (part of a name, a pattern with `*`, or `*`) and adds
|
|
1450
|
+
the ticked ones. Each object is a box with its columns, their types, `P` (primary key), `F` (foreign
|
|
1451
|
+
key), `U` (unique) and `*` for not null; a foreign key between two shown tables is a line from the
|
|
1452
|
+
referencing table (a crow's foot: many) to the referenced one (a bar: one), dashed with a circle
|
|
1453
|
+
when the foreign key may be empty. A box's name opens **Table Properties** (a view: the Object
|
|
1454
|
+
Browser). The toolbar: **Save** (Ctrl+S), **Undo** / **Redo** (Ctrl+Z, Ctrl+Y), **Zoom out** / **Zoom
|
|
1455
|
+
in** (or Ctrl+wheel), **Fit**, **Auto layout** (referenced tables to the left of the tables that
|
|
1456
|
+
reference them; undoable), a **Mini-map** (click or drag in it to move around), **SVG** and **PNG**
|
|
1457
|
+
exports of the diagram as shown, **Print**, **Generate DDL** (the CREATE statements of the shown
|
|
1458
|
+
objects with their keys, indexes, triggers, row level security, policies, comments and grants: to
|
|
1459
|
+
download or open in the SQL Worksheet) and **Data dictionary** (each object's columns with type,
|
|
1460
|
+
nullability, default, keys and comments, its constraints and what references it; to print, save as
|
|
1461
|
+
PDF from the print dialog, or download as an HTML file). Drag a box to move it, or focus it and use
|
|
1462
|
+
the arrow keys (Shift for bigger steps). The diagram keeps only the objects' names and positions
|
|
1463
|
+
(`meta.sql_diagram`): columns and keys are read from the catalog each time, so it never goes stale;
|
|
1464
|
+
an object dropped from the schema is reported and left out on the next save. Without JavaScript the
|
|
1465
|
+
diagram shows at its saved positions, and adding, removing, auto layout, Export SVG, DDL and the
|
|
1466
|
+
dictionary all work. Diagrams are installation data, not exported with applications.
|
|
1386
1467
|
- **Load Data**: load a CSV, TSV, Excel, JSON or XML file into a new table (with inferred column
|
|
1387
1468
|
types) or an existing one (append, merge by primary key, or replace), with a per-row error
|
|
1388
1469
|
report, or with a saved **data load definition**; a mapping can be saved as one
|
|
@@ -1414,8 +1495,37 @@ others (Quick SQL, Query Builder, Load and Unload Data, Sample Data, DDL, Compar
|
|
|
1414
1495
|
replaces views and functions, drops and creates constraints, indexes, triggers, policies and
|
|
1415
1496
|
grants that differ, and lists for review what it doesn't change: drops of what only the target
|
|
1416
1497
|
has (commented out), columns whose identity or generation differs, and types, domains and
|
|
1417
|
-
sequences that differ.
|
|
1498
|
+
sequences that differ. (sprint 106) *Apply and record* runs the script on the target in one transaction and records
|
|
1499
|
+
it in the Change Log (below). The same from the command line (`pgkiln ddl`, `pgkiln compare`,
|
|
1418
1500
|
[chapter 18](18-cli.md)) and for AI agents (`generate_ddl`, `compare_schemas`).
|
|
1501
|
+
- **RESTful Services** (`/builder/sql/rest`, sprint 100; Database Actions: REST › AutoREST): publish a table or
|
|
1502
|
+
view as REST endpoints. Choose the object (of a schema the SQL Workshop may use), the **application** it is
|
|
1503
|
+
published through, a URL name, the **methods** (GET: rows and one row; POST; PUT; DELETE; single rows need a primary
|
|
1504
|
+
key), **who may call it** (a bearer token of the application, or explicitly *public*), optional application
|
|
1505
|
+
**roles** and the page size. The application decides the rest: the statements run as its database role (never the
|
|
1506
|
+
object's owner, a superuser or a role that bypasses row level security), with its tokens and OAuth clients and its
|
|
1507
|
+
accounts' roles. The object's page checks the role's grants per method, row level security and (for a view)
|
|
1508
|
+
`security_invoker`, lists the endpoints with their URLs, and shows cURL and `fetch` examples and the OpenAPI link.
|
|
1509
|
+
Details in [chapter 13](13-rest-api.md#autorest-tables-and-views-from-the-sql-workshop).
|
|
1510
|
+
(sprint 104; Database Actions: REST › Modules) The **Modules** tab edits the REST modules of the workspace's
|
|
1511
|
+
applications as a tree: a module (its base path and its privilege: roles every handler needs), its templates (URIs
|
|
1512
|
+
with `:parameters`) and their handlers (method, source type: collection query, single row, SQL, PL/pgSQL or media,
|
|
1513
|
+
who may call it, roles, documented parameters). Each handler has a **Try it** panel: the request goes to the real
|
|
1514
|
+
endpoint without a token or as an account of the application, and the response is shown in the page. Details in
|
|
1515
|
+
[chapter 13](13-rest-api.md#modules-templates-and-handlers-in-the-sql-workshop).
|
|
1516
|
+
- **Change Log** (`/builder/sql/changes`, sprint 106; Database Actions: Liquibase): DDL that succeeds in the **SQL
|
|
1517
|
+
Worksheet**, **Table Properties** (*Apply*) and **Schema Comparison** (*Apply and record*: the change script run on
|
|
1518
|
+
the target in one transaction) is recorded as a *change set*: the schema it changes, its SQL, who ran it, when,
|
|
1519
|
+
where from and a number per schema that is never given again (deleting a change set keeps the others' numbers).
|
|
1520
|
+
Statements without a schema-qualified name count for the worksheet's schema. Only schema DDL is kept (CREATE,
|
|
1521
|
+
ALTER, DROP, COMMENT, GRANT and REVOKE on objects): no queries or data changes, and nothing about roles, databases
|
|
1522
|
+
or servers, so passwords never end up in the log. The page lists a schema's change sets with their SQL; rename one
|
|
1523
|
+
(its file name) or delete it from the log (the database is not changed). It marks which change sets were made
|
|
1524
|
+
before the latest **Export** of an application of the workspace (*in it*) and which after (*still to ship*).
|
|
1525
|
+
*Download migration* writes all of them, those not yet written to a file, or those after the latest export, as
|
|
1526
|
+
**Flyway** versioned migrations (`V0001__add_bonus.sql`; several in a zip), a **Liquibase** formatted SQL changelog
|
|
1527
|
+
(`--liquibase formatted sql`, `--changeset author:0001-add_bonus`) or one plain SQL script; each change set also
|
|
1528
|
+
has its own Flyway file. Change sets belong to the workspace and are not part of an application export.
|
|
1419
1529
|
- **Utilities** (`/builder/sql/utilities`; APEX: SQL Workshop → Utilities): tiles for Load and Unload Data, Sample
|
|
1420
1530
|
Data, the Query Builder, DDL and Compare, and three pages of their own. Each runs in a read-only transaction with a
|
|
1421
1531
|
15-second statement timeout, on the SQL Workshop's connection (an isolated workspace's developers see only the
|
|
@@ -1426,12 +1536,162 @@ others (Quick SQL, Query Builder, Load and Unload Data, Sample Data, DDL, Compar
|
|
|
1426
1536
|
to the Object Browser. pgkiln's own `meta` schema and the system's are left out.
|
|
1427
1537
|
- **About Database**: the PostgreSQL version, database size, uptime, a few settings (encoding, time zone,
|
|
1428
1538
|
connections, memory, row security), the installed extensions and the schemas with their size.
|
|
1429
|
-
- **
|
|
1430
|
-
|
|
1431
|
-
|
|
1539
|
+
- **SQL Monitor** (administrators only): see [SQL Monitor](#sql-monitor) below (it replaced the Database Monitor;
|
|
1540
|
+
the old address `/builder/sql/utilities/monitor` redirects).
|
|
1541
|
+
- **Database Users** (administrators only; Administration menu → *Database users*, `/builder/db-users`; sprint 99,
|
|
1542
|
+
Database Actions: Database Users): see [Database users](#database-users).
|
|
1543
|
+
- **Schema Export / Import** (administrators only; `/builder/sql/data-pump`; sprint 103, Database Actions: Data
|
|
1544
|
+
Pump): see [Schema export and import](#schema-export-and-import).
|
|
1545
|
+
- **Scheduling** (administrators only; `/builder/sql/scheduling`, on the Launchpad under *Administration*, the
|
|
1546
|
+
Utilities page and the search; sprint 101, Database Actions: Scheduling): [pg_cron](#scheduling-with-pg_cron) jobs.
|
|
1432
1547
|
|
|
1433
1548
|
Because the SQL Workshop runs as the owner, restrict who gets a developer account.
|
|
1434
1549
|
|
|
1550
|
+
### SQL Monitor
|
|
1551
|
+
|
|
1552
|
+
(sprint 102; Database Actions: Real Time SQL Monitor and Performance Hub) **SQL Workshop → SQL Monitor**
|
|
1553
|
+
(`/builder/sql/monitor`, administrators only; on the Launchpad under *Monitoring*, in the Utilities and in the search,
|
|
1554
|
+
Ctrl+K) shows what the database is doing, from PostgreSQL's statistics views:
|
|
1555
|
+
|
|
1556
|
+
- **Sessions**: tiles with the sessions (of `max_connections`), the active ones, those idle in a transaction, the
|
|
1557
|
+
blocked ones and the longest running statement; then the client sessions of this database (`pg_stat_activity`;
|
|
1558
|
+
idle sessions on request, *Show idle sessions*) with user, application and client address, state (idle in a
|
|
1559
|
+
transaction with its time), wait event, running time, the sessions that **block** it (the row is highlighted) and
|
|
1560
|
+
the query. A query with a `query_id` links to its statement page. **Cancel** (`pg_cancel_backend`: stop the running
|
|
1561
|
+
statement) and **Terminate** (`pg_terminate_backend`: roll back and disconnect) ask for a confirmation first; only
|
|
1562
|
+
client sessions of this database can be signalled, and the owner role needs the right to (a superuser, the
|
|
1563
|
+
session's own role, or `pg_signal_backend` for non-superusers' sessions).
|
|
1564
|
+
- **Wait events**: what the active sessions of the server wait for now, counted per type and event (*CPU: running*
|
|
1565
|
+
when they don't wait).
|
|
1566
|
+
- **In progress** (only when something runs): VACUUM, ANALYZE, CREATE INDEX, CLUSTER and COPY from the
|
|
1567
|
+
`pg_stat_progress_*` views, with the phase and a progress bar.
|
|
1568
|
+
- The tiles and tables **refresh in place** every 5, 15 or 60 seconds, with a **Pause** button; the choice is
|
|
1569
|
+
remembered in the browser. Without JavaScript, *Refresh* reloads the page.
|
|
1570
|
+
- **Top SQL**: the statements of this database from `pg_stat_statements`, every role: calls, total and mean time
|
|
1571
|
+
(with bars), rows, shared blocks hit and read; sort by any column (click the heading again to reverse), search the
|
|
1572
|
+
text, **Reset statistics** (the whole server, after a confirmation). Literals show as `$1`, `$2`….
|
|
1573
|
+
- **A statement**: its text, its totals (calls, total and mean time, rows, blocks, temporary blocks) and a row per
|
|
1574
|
+
role with standard deviation, minimum and maximum; **Explain** shows its plan as a tree like the worksheet's. It is
|
|
1575
|
+
`EXPLAIN` only, never `EXPLAIN ANALYZE` (the statement is someone else's): a text with parameters gets a generic
|
|
1576
|
+
plan (`EXPLAIN (GENERIC_PLAN)`, PostgreSQL 16 or later), in a read-only transaction that is rolled back, with
|
|
1577
|
+
a 5-second timeout and one statement only. Choose the schema its unqualified names live in. **Open in worksheet**
|
|
1578
|
+
puts the text in the SQL Worksheet.
|
|
1579
|
+
|
|
1580
|
+
Top SQL needs the `pg_stat_statements` extension, which the server must load (`shared_preload_libraries`); pgkiln
|
|
1581
|
+
creates the extension when it can (migration 016). Without it the page says how to turn it on. The per-application
|
|
1582
|
+
**Top SQL** on an application's Activity page shows the same statistics for its database role only.
|
|
1583
|
+
|
|
1584
|
+
### Database users
|
|
1585
|
+
|
|
1586
|
+
(sprint 99; Database Actions: Database Users) **Administration → Database users** (administrators only; also on the
|
|
1587
|
+
SQL Workshop's Launchpad under *Administration*) lists the PostgreSQL roles of the server (`pg_roles`; the predefined
|
|
1588
|
+
`pg_` roles are left out): whether they can sign in, superuser / create DB / create role / bypass RLS / replication,
|
|
1589
|
+
the connection limit, **valid until** (with *in N days* or *expired*), the roles they are a member of and what they own
|
|
1590
|
+
(schemas, objects in this database, objects elsewhere). PostgreSQL doesn't record when a role was created.
|
|
1591
|
+
The tiles on top filter the list: roles that can sign in, **passwords that expire within 30 days**, roles with
|
|
1592
|
+
**BYPASSRLS**, roles **without sign-in that own objects**, and pgkiln's own roles; a search field filters by name.
|
|
1593
|
+
|
|
1594
|
+
**Create database user** (or a role's page) is a form: name, *Can sign in* (LOGIN), the password (*No password* /
|
|
1595
|
+
*Set a password*; for an existing role *Keep*, *Set a new password* or *Remove*), **valid until** (a date; empty: no
|
|
1596
|
+
expiry), the connection limit, the roles it is a **member of** (group roles and the predefined roles; not pgkiln's own,
|
|
1597
|
+
superusers, login roles or the roles that reach the server's files), its **default schema** (the search path in this
|
|
1598
|
+
database: `ALTER ROLE … IN DATABASE … SET search_path`), a comment, and per schema **Usage** and **Create**,
|
|
1599
|
+
**Future tables** (default privileges, *read* or *read and write*, on what pgkiln's owner connection creates there) and
|
|
1600
|
+
**Existing tables** (a one-off grant or revoke on the tables there now). pgkiln's own schemas aren't offered.
|
|
1601
|
+
|
|
1602
|
+
**Review SQL** shows the statements (only what differs from what the catalog says now), with the password as
|
|
1603
|
+
`'********'`; the password itself is typed on that page (twice) and **Apply** runs the statements in one
|
|
1604
|
+
transaction: all or none, and the error with the statement that failed. Apply runs only what the review showed:
|
|
1605
|
+
when the form or the role changed in between, the review comes again. The masked statements go to the activity log
|
|
1606
|
+
(event `db_role`).
|
|
1607
|
+
|
|
1608
|
+
**Drop role…** lists what the role owns and warns about objects in other databases; it reassigns them to another role
|
|
1609
|
+
(`REASSIGN OWNED`) or, with a tick, drops them (`DROP OWNED`), revokes its privileges in this database and drops the
|
|
1610
|
+
role, again after showing the SQL.
|
|
1611
|
+
|
|
1612
|
+
pgkiln's **own roles** are marked *pgkiln* and are read only here: the owner and runtime connections (`DATABASE_URL`,
|
|
1613
|
+
`RUNTIME_DATABASE_URL`), every `pgkiln…` role (`pgkiln_runtime`, `pgkiln_app_code`, `pgkiln_authenticator`,
|
|
1614
|
+
`pgkiln_anon`, isolated workspaces' logins) and the bootstrap superuser. Roles **in use** by an application (parsing
|
|
1615
|
+
schema, REST API role) or an isolated workspace can be changed but not dropped. New names can't start with `pg_` or
|
|
1616
|
+
`pgkiln`. The owner connection needs `CREATEROLE` (and, on PostgreSQL 16 and later, ADMIN on roles it didn't create)
|
|
1617
|
+
for these changes; PostgreSQL's own error says so otherwise.
|
|
1618
|
+
|
|
1619
|
+
### Schema export and import
|
|
1620
|
+
|
|
1621
|
+
(sprint 103; Database Actions: Data Pump) **SQL Workshop → Schema Export / Import** (administrators only; on the
|
|
1622
|
+
Launchpad under *Administration* and on the Utilities page) dumps a schema to a file with **pg_dump** and loads a
|
|
1623
|
+
file into a schema with **pg_restore**, as background jobs. The list shows every job: export or import, the schema,
|
|
1624
|
+
its status (*running*, *succeeded*, *failed*, *cancelled*, or *uploaded* for a file waiting for its options), the
|
|
1625
|
+
file's size, when it started, how long it took and who ran it. A job's page has its options, pg_dump's or the
|
|
1626
|
+
import's **log**, and **Download**, **Import…**, **Cancel** (while it runs) and **Delete** (the job and its file).
|
|
1627
|
+
|
|
1628
|
+
**Export a schema**: pick a schema (not pgkiln's own `meta`, PostgreSQL's or an extension's), then
|
|
1629
|
+
|
|
1630
|
+
- the **format**: *custom* (compressed, `pg_dump -Fc`; what Import reads) or *plain SQL* (for `psql`; not imported
|
|
1631
|
+
here; owners are left out);
|
|
1632
|
+
- the **content**: definitions and data, definitions only (`--schema-only`) or data only (`--data-only`), with or
|
|
1633
|
+
without **grants**;
|
|
1634
|
+
- the **tables, views and sequences**: the whole schema, only the checked ones (`--table`: the file then has no
|
|
1635
|
+
CREATE SCHEMA and no functions or types), or all but the checked ones (`--exclude-table`).
|
|
1636
|
+
|
|
1637
|
+
pg_dump runs with an argument list (no shell) on the owner connection (`DATABASE_URL`); the password goes in
|
|
1638
|
+
`PGPASSWORD`, never on the command line. The file is kept in the dump directory for `PGKILN_DUMP_KEEP_DAYS` days
|
|
1639
|
+
(default 7); then the scheduler removes it and the job stays in the list.
|
|
1640
|
+
|
|
1641
|
+
**Import**: upload a custom or tar archive of **one schema** (`pg_dump -Fc -n <schema>`, up to `PGKILN_DUMP_MAX_MB`,
|
|
1642
|
+
default 2048 MB; the file is streamed to the dump directory), or pick a kept export. The next page shows what the
|
|
1643
|
+
archive holds (`pg_restore --list`): the schema, the tables, the object types and how many of each, the server and
|
|
1644
|
+
pg_dump versions. Then choose
|
|
1645
|
+
|
|
1646
|
+
- the **schema** to import into: the dump's own name or another one, **new or existing**. Another name renames the
|
|
1647
|
+
dump's schema in the same transaction (*create schema as*);
|
|
1648
|
+
- the **content** (definitions and data, definitions only, data only: data goes into the tables that are there, in
|
|
1649
|
+
foreign key order, parents first);
|
|
1650
|
+
- **Drop the dump's objects in the schema first** (`pg_restore --clean --if-exists`, to replace what an earlier import
|
|
1651
|
+
made) and **Grants**.
|
|
1652
|
+
|
|
1653
|
+
pg_restore writes the script (`pg_restore -f -`, without a connection of its own) and pgkiln runs it on one
|
|
1654
|
+
connection in **one transaction**, so an error rolls everything back:
|
|
1655
|
+
|
|
1656
|
+
```sql
|
|
1657
|
+
begin;
|
|
1658
|
+
alter schema hr rename to pgkiln_dump_42; -- importing hr as hr_copy while hr exists: the original steps aside
|
|
1659
|
+
alter schema hr_copy rename to hr; -- only when hr_copy exists: the dump's names now mean it
|
|
1660
|
+
-- the dump's statements and COPY data (CREATE SCHEMA left out when the schema exists)
|
|
1661
|
+
alter schema hr rename to hr_copy;
|
|
1662
|
+
alter schema pgkiln_dump_42 rename to hr;
|
|
1663
|
+
commit;
|
|
1664
|
+
```
|
|
1665
|
+
|
|
1666
|
+
Other sessions keep seeing the original schema until the commit. Views, column defaults, triggers, policies and
|
|
1667
|
+
SQL-standard function bodies refer to objects, so they follow the rename; **names inside PL/pgSQL bodies** and other
|
|
1668
|
+
text (dynamic SQL, a function's `SET search_path`) still say the dump's schema after a rename. Objects are owned by
|
|
1669
|
+
pgkiln's owner role (`--no-owner`); security labels, tablespaces, publications and subscriptions are left out.
|
|
1670
|
+
|
|
1671
|
+
Every statement is checked before it runs: the settings pg_dump writes, CREATE / ALTER / COMMENT / GRANT / DROP of
|
|
1672
|
+
objects **in the dump's schema**, `COPY … FROM stdin` into its tables and `setval` of its sequences. Anything else is
|
|
1673
|
+
refused and rolls the import back: objects in other schemas (`meta` among them), roles and role memberships, `SET
|
|
1674
|
+
ROLE`, `OWNER TO`, `SET SCHEMA`, `DO`, `COPY` from or to files and programs, extensions, and psql meta-commands (other
|
|
1675
|
+
than pg_dump's `\restrict`). An archive with several schemas, extensions or large objects is refused at the preview.
|
|
1676
|
+
A dump is still code: its functions and triggers run as pgkiln's owner role. **Import only dumps you trust.**
|
|
1677
|
+
|
|
1678
|
+
**The client programs.** pg_dump can't dump a server newer than itself, so pgkiln looks for pg_dump and pg_restore of
|
|
1679
|
+
the server's major version or newer, the newest it finds: `PGKILN_PG_BIN` (a directory), else
|
|
1680
|
+
`/usr/lib/postgresql/<n>/bin` (Debian, Ubuntu), `/usr/pgsql-<n>/bin` (RHEL), Homebrew's `postgresql@<n>`, else `PATH`.
|
|
1681
|
+
Without them the page says what to install (`postgresql-client-17` for a PostgreSQL 17 server). The Docker image
|
|
1682
|
+
includes PostgreSQL 17's client programs and keeps the files in `/app/dumps` (a volume in `deploy/compose.yaml`).
|
|
1683
|
+
|
|
1684
|
+
| Variable | Default | |
|
|
1685
|
+
|---|---|---|
|
|
1686
|
+
| `PGKILN_PG_BIN` | (searched) | the directory of pg_dump and pg_restore |
|
|
1687
|
+
| `PGKILN_DUMP_DIR` | `<temp>/pgkiln-dumps` | where the files are kept; one server's directory: with several pgkiln servers, a job's file is on the server that ran it |
|
|
1688
|
+
| `PGKILN_DUMP_KEEP_DAYS` | 7 | days a file is kept |
|
|
1689
|
+
| `PGKILN_DUMP_MAX_MB` | 2048 | the largest upload |
|
|
1690
|
+
|
|
1691
|
+
A job runs in the server that started it: when that server stops, the scheduler marks its running jobs *failed
|
|
1692
|
+
(interrupted)* within two minutes. Exports, uploads, imports and downloads go to the activity log (`schema_export`,
|
|
1693
|
+
`schema_upload`, `schema_import`, `schema_download`).
|
|
1694
|
+
|
|
1435
1695
|
## Export and import
|
|
1436
1696
|
|
|
1437
1697
|
**Export** downloads the application as JSON: pages, all components, shared components and
|
|
@@ -511,6 +511,35 @@ refused ([chapter 16](16-files.md#data-loading)). The SQL Workshop (the SQL Work
|
|
|
511
511
|
Quick SQL, Load Data, Unload Data, Sample Data) runs as the owner instead, so every developer can change any table: keep
|
|
512
512
|
developer accounts to people you trust with the database.
|
|
513
513
|
|
|
514
|
+
The REST endpoints pgkiln serves (an application's REST modules and the tables and views published with **SQL
|
|
515
|
+
Workshop → RESTful Services**, AutoREST) run as the app role too, never as the owner: these grants, column grants
|
|
516
|
+
and the row level security below decide what an API caller may read and change. AutoREST refuses a role that owns
|
|
517
|
+
the published object or bypasses row level security, and an object answers only to a bearer token of its application
|
|
518
|
+
unless the developer chose *public* for it ([chapter 13](13-rest-api.md#autorest-tables-and-views-from-the-sql-workshop)).
|
|
519
|
+
(sprint 104) REST module handlers refuse to run as a superuser, a role that bypasses row level security or a member
|
|
520
|
+
of pgkiln's owner (403). Their parameters are bound: SQL handlers get escaped literals, PL/pgSQL handlers read
|
|
521
|
+
transaction-local settings through `meta.rest_param()`; a request can't set the server's binds (`APP_USER`, …) or
|
|
522
|
+
real settings. Media handlers are served with a sandboxing Content-Security-Policy and `nosniff`. *Try it* in the
|
|
523
|
+
SQL Workshop calls an endpoint as an account of the application, as a developer issuing a token could
|
|
524
|
+
([chapter 13](13-rest-api.md#modules-templates-and-handlers-in-the-sql-workshop)).
|
|
525
|
+
|
|
526
|
+
(sprint 106) The SQL Workshop's **Change Log** keeps the schema DDL developers run from the worksheet, Table
|
|
527
|
+
Properties and Schema Comparison, per workspace (only the workspace's developers see it). Statements about roles,
|
|
528
|
+
databases, servers, user mappings and subscriptions are never recorded, so passwords and connection strings stay
|
|
529
|
+
out of it; it holds what the DDL says otherwise (defaults, comments, function bodies).
|
|
530
|
+
|
|
531
|
+
### Database users and their passwords
|
|
532
|
+
|
|
533
|
+
(sprint 99) Administrators create and change PostgreSQL roles in the builder (**Administration → Database users**,
|
|
534
|
+
[chapter 3](03-builder.md#database-users)). Passwords never reach PostgreSQL or a page in plain text: pgkiln hashes
|
|
535
|
+
a new password itself into a **SCRAM-SHA-256 verifier** (random salt, 4096 iterations, SASLprep, like psql's
|
|
536
|
+
`\password`) and the statement carries only that verifier, as a literal built with pg's `escapeLiteral`. The review
|
|
537
|
+
and the activity log show `PASSWORD '********'`; the password is typed on the review page, posted once with Apply and
|
|
538
|
+
not stored, echoed or logged. A server with `log_statement = ddl` logs the verifier, not the password. Every name is
|
|
539
|
+
quoted with `escapeIdentifier`, every value is checked (dates, numbers, schema names, grantable roles) and quoted.
|
|
540
|
+
The page is for administrators only (others get 403), every change needs the CSRF token, and pgkiln's own roles can't
|
|
541
|
+
be changed, dropped or granted from it, so the page can't take pgkiln's own connections away.
|
|
542
|
+
|
|
514
543
|
## Session state protection
|
|
515
544
|
|
|
516
545
|
- **URL items**: on pages with protection *Arguments must have checksum* (the default), item
|
|
@@ -69,6 +69,9 @@ src/
|
|
|
69
69
|
sqlscript.ts SQL scripts: splitScript() (statements, line numbers and offsets, psql commands), runScript() (stop/continue, transaction, savepoints)
|
|
70
70
|
sqlworksheet.ts (sprint 91) the worksheet's runs: pickStatements() (at the cursor, a selection, all), runStatements() (a log per
|
|
71
71
|
statement, psql command tags, notices, error line and column), explainStatement() (EXPLAIN / rolled-back ANALYZE)
|
|
72
|
+
datamodel.ts (sprint 98) Data Modeler diagrams: readModel() (catalog), boxSize(), fkPath() (crow's feet), autoLayout(), diagramSvg()
|
|
73
|
+
changelog.ts (sprint 106, migration 118) the change log: isSchemaDdl(), ddlTarget() (schema and object), changeName()
|
|
74
|
+
(add_bonus, create_index_x), recordChanges() (grouped per schema), Flyway / Liquibase / plain SQL writers
|
|
72
75
|
tabledef.ts (sprint 95) a table as a definition: readTable(), checkTable(), tableSql() (CREATE, or ALTER from the catalog's version)
|
|
73
76
|
sqlformat.ts (sprint 93) formatSql(): the worksheet's Format (clauses per line, keyword case; strings and comments kept)
|
|
74
77
|
sqlplan.ts (sprint 92) EXPLAIN (FORMAT JSON) as a tree: parsePlan() (self time, slowest step, misestimates), planText()
|
|
@@ -86,6 +89,19 @@ src/
|
|
|
86
89
|
mvt.ts Mapbox Vector Tile encoding for map layers served as tiles
|
|
87
90
|
yamltext.ts the text style of the directory export: a strict YAML subset, written and read
|
|
88
91
|
webclient.ts outgoing HTTP to web services: allow-list, address checks at connect time (SSRF), redirects, limits
|
|
92
|
+
datapump.ts (sprint 103, DA-16) Schema Export / Import jobs (meta.dump_job): findTools (pg_dump/pg_restore ≥ the
|
|
93
|
+
server's major), startExport (pg_dump, argument array, PGPASSWORD), readToc/parseToc (pg_restore --list),
|
|
94
|
+
startImport (pg_restore -f - run in one transaction between schema renames; data-only in FK order),
|
|
95
|
+
cancel, delete, dumpTick (interrupted jobs, expired files; called by the scheduler)
|
|
96
|
+
dumpscript.ts (sprint 103) the import's script runner: ScriptLexer (psql-style split, COPY data, \restrict),
|
|
97
|
+
checkStatement (only the dump's schema; no roles, DO, COPY to/from files…), COPY FROM STDIN as a pg submittable
|
|
98
|
+
dbroles.ts (sprint 99, DA-13) Database Users' SQL: roleSql (CREATE/ALTER ROLE, memberships, search path, schema
|
|
99
|
+
and default privileges: only what differs from the catalog), dropSql, checkRole/checkPassword,
|
|
100
|
+
scramVerifier (SCRAM-SHA-256, SASLprep) and the password slot (maskSql for review and log, withVerifier to run)
|
|
101
|
+
cron-schedule.ts (sprint 101, DA-12) pg_cron schedules without a database: parseSchedule (cron fields, $, n seconds, macros),
|
|
102
|
+
nextRuns in a time zone, describeSchedule in words, the builder's presets and fields
|
|
103
|
+
pgcron.ts (sprint 101, DA-12) pg_cron for SQL Workshop → Scheduling: cronState (installed, loaded, cron.database_name,
|
|
104
|
+
access), jobs and runs, jobSql/activeSql/unscheduleSql/purgeSql (reviewed, then applySql), runNow
|
|
89
105
|
secrets.ts secrets at rest (web credentials): AES-256-GCM with PGKILN_SECRET_KEY
|
|
90
106
|
websources.ts web credentials (OAuth2 client credentials/password/refresh token grants, token cache, stored refresh
|
|
91
107
|
tokens) and REST data sources: requests, JSON paths, typed rows, response cache, write-back operations
|
|
@@ -148,7 +164,13 @@ src/
|
|
|
148
164
|
maps.ts map region (data for Leaflet: layers with a query each, markers, clusters or heat, PostGIS geometry as GeoJSON, report filter by area or distance; list fallback, head assets)
|
|
149
165
|
spatial.ts spatial filtering on the server: map area and distance parsing, PostGIS detection and SQL (ST_Intersects, ST_DWithin), lat/lng fallback (bounding box, haversine)
|
|
150
166
|
pwa.ts Progressive Web App: manifest, service worker route, icons (PNG encoder), offline page
|
|
151
|
-
rest.ts REST modules: handler checks, matching, bearer tokens,
|
|
167
|
+
rest.ts REST modules: handler and template checks, matching, bearer tokens, module privilege, the constrained-role
|
|
168
|
+
check, execution (collections stream from a cursor), OpenAPI (templates, documented parameters, roles)
|
|
169
|
+
rest-handlers.ts (sprint 104, migration 117) PL/pgSQL handlers (binds as settings, DO block, meta.rest_reply) and media
|
|
170
|
+
handlers (content type and file name cleaned, sandboxed response)
|
|
171
|
+
autorest.ts (sprint 100, migration 113) AutoREST: /a/:alias/autorest/<object>/ for the tables and views SQL Workshop →
|
|
172
|
+
RESTful Services published (meta.rest_object): caller() of rest.ts, SET ROLE to the app role, owner/BYPASSRLS
|
|
173
|
+
check, columns from the catalog (column grants), filters/q/order/paging, POST/PUT/DELETE by primary key, OpenAPI
|
|
152
174
|
rest-sources.ts REST data sources in apps: regions and LOVs as SQL over "rest", the invoke_api process (items; the call is websources.ts invoke()),
|
|
153
175
|
write-back of forms (fetch, form_dml) and grids (grid_dml) through the source's operations
|
|
154
176
|
tree.ts tree region
|
|
@@ -221,6 +243,11 @@ src/
|
|
|
221
243
|
errors.ts (sprint 86) the builder's HTML 404 and 500 pages for browsers (wantsHtml, a not-found handler and an onSend hook)
|
|
222
244
|
arrange.ts page designer layout changes: move, column span, create from the gallery, undo / redo
|
|
223
245
|
sql.ts SQL Workshop: the home and the session's schema
|
|
246
|
+
launchpad.ts (sprint 96) the SQL Workshop home's Launchpad (pins in meta.builder_pin, 109; tool groups), POST /builder/pins,
|
|
247
|
+
GET /builder/palette (the builder's search: JSON for Ctrl+K, a results page without JavaScript)
|
|
248
|
+
sql-charts.ts (sprint 97) charts of a query: chartSpec(), drawChart() (runtime/charts.ts, a PageCss in a nonce'd <style>), the
|
|
249
|
+
worksheet's Chart tab, SQL Workshop → Charts (meta.sql_chart, 110; read-only runs)
|
|
250
|
+
sql-tools.ts (sprint 96) SQL_TOOLS: every SQL Workshop tool with its group, tab and description (home, More menu, search)
|
|
224
251
|
worksheet.ts (sprint 91) the SQL Worksheet (Database Actions' SQL; /sql/commands too): navigator (pickSchema, objects with
|
|
225
252
|
columns, objectStatements), toolbar, output tabs, history (meta.sql_history, 108), plan trees, Run as an app's role, (sprint 93) Save / Rename / Download as SQL Scripts, bind and substitution values, POST /sql/worksheet/format; GET /sql/worksheet/navigator
|
|
226
253
|
object-browser.ts (sprint 75) the Object Browser: objects by type, system objects hidden, a table in tabs, column actions as SQL to review
|
|
@@ -228,10 +255,20 @@ src/
|
|
|
228
255
|
(one transaction) / Open in the worksheet
|
|
229
256
|
object-actions.ts (sprint 94) an object's ⋯ menu (objectMenu) in the worksheet and the Object Browser: Quick DDL (objectDdl), Drop with
|
|
230
257
|
dependents, Add index / trigger / policy as drafts; GET /sql/objects/action, /sql/objects/panel (Open in a panel)
|
|
258
|
+
data-modeler.ts (sprint 98) SQL Workshop → Data Modeler: /sql/modeler (diagrams, meta.sql_diagram, 111), /:id (SVG), /:id/objects, /layout,
|
|
259
|
+
/rename, /delete, /svg (export), /ddl (diagramDdl), /dictionary (data dictionary, ?download=1)
|
|
231
260
|
scripts.ts SQL Workshop → SQL Scripts: editor, upload/download, run, results per statement, run history
|
|
232
261
|
quicksql.ts SQL Workshop → Quick SQL page (preview, save as script, run)
|
|
233
262
|
querybuilder.ts SQL Workshop → Query Builder: catalog, joins by foreign key or drawn, functions/group by, buildQuery() from the URL; the canvas is in builder.js
|
|
234
263
|
users.ts user directory and identity providers
|
|
264
|
+
datapump.ts (sprint 103, DA-16) SQL Workshop → Schema Export / Import (/builder/sql/data-pump, administrators only):
|
|
265
|
+
jobs, export form, upload (streamed to PGKILN_DUMP_DIR), archive preview and import options, job log, download
|
|
266
|
+
db-users.ts (sprint 99, DA-13) Administration → Database Users (/builder/db-users, administrators only): PostgreSQL
|
|
267
|
+
roles with highlights, create/edit (review the masked SQL, then Apply in one transaction), drop with
|
|
268
|
+
reassigning; pgkiln's own roles read-only, roles of applications and workspaces not dropped
|
|
269
|
+
scheduling.ts (sprint 101, DA-12) SQL Workshop → Scheduling (/builder/sql/scheduling, administrators only): pg_cron jobs
|
|
270
|
+
with next runs, create/edit with a schedule builder and preview (review the SQL, then Apply), disable,
|
|
271
|
+
run now, unschedule, run history and purge; without pg_cron the install note and pgkiln's automations
|
|
235
272
|
api.ts per-app REST API page (API role, tokens)
|
|
236
273
|
globalization.ts translations, XLIFF/CSV, text messages
|
|
237
274
|
dataload.ts SQL Workshop → Load Data (with definitions, save a mapping as one); data load definition spec (Shared Components)
|
|
@@ -243,11 +280,18 @@ src/
|
|
|
243
280
|
region-settings.ts page designer: settings forms for grid, chart (gauge, drill-down), cards, calendar (views, create, drag and drop), facets, smart filters, display selector, list
|
|
244
281
|
search.ts app search, "where used" (appEntries, search, whereUsed, usedInPanel)
|
|
245
282
|
advisor.ts Advisor: EXPLAIN every SQL fragment, reference checks, plpgsql_check
|
|
246
|
-
ddl-tools.ts SQL Workshop → DDL and Compare (src/ddl.ts)
|
|
283
|
+
ddl-tools.ts SQL Workshop → DDL and Compare (src/ddl.ts); (sprint 106) the Apply and record form
|
|
284
|
+
changelog.ts (sprint 106) SQL Workshop → Change Log (/builder/sql/changes): change sets per schema, latest app export,
|
|
285
|
+
downloads (POST, mark exported_at), rename, delete; /sql/compare/apply (one transaction, recorded)
|
|
247
286
|
sql-utilities.ts SQL Workshop → Utilities (sprint 62): the tools' tiles, OBJECT_REPORTS (fixed catalogue SQL over the
|
|
248
|
-
connection's usable schemas), About Database
|
|
287
|
+
connection's usable schemas), About Database; read only, with a timeout; /sql/utilities/monitor redirects to the SQL Monitor
|
|
249
288
|
login-page.ts Application settings → Login page and Forgot password; Create a login page (page 9999)
|
|
250
|
-
top-sql.ts Top SQL per app role from pg_stat_statements
|
|
289
|
+
top-sql.ts Top SQL per app role from pg_stat_statements; (sprint 102) statementsState / statementsNote (installed and loaded?)
|
|
290
|
+
sql-monitor.ts (sprint 102, DA-14) SQL Workshop → SQL Monitor (administrators): /sql/monitor (sessions, wait events, progress;
|
|
291
|
+
?fragment=1 the live part), POST /sql/monitor/session (cancel / terminate), /sql/monitor/top (topStatements:
|
|
292
|
+
pg_stat_statements sortable, bars), /reset, /statements/:queryid (totals by role, explainForMonitor: EXPLAIN only,
|
|
293
|
+
one statement by the extended protocol, read only, generic plan for $1), /statements/:queryid/worksheet
|
|
294
|
+
plan-view.ts (sprint 92; shared since 102) planView(): a plan (src/sqlplan.ts) as a tree, for the worksheet and the SQL Monitor
|
|
251
295
|
diagnostics.ts Activity → Debug messages (level, list, one request's entries, purge); Workspace utilities →
|
|
252
296
|
Installation (version, install/upgrade runs, applied and missing migrations; administrators)
|
|
253
297
|
ldap.ts Users → LDAP directories
|
|
@@ -259,6 +303,12 @@ src/
|
|
|
259
303
|
form-designer.ts page designer: Form Designer settings (designers' scheme; sources: key, actions, offered columns, labels, lists of values)
|
|
260
304
|
workingcopies.ts Working copies: list and create, compare with differences, merge or refresh with conflict choices, delete
|
|
261
305
|
rest.ts REST module endpoints list and curl example (Shared Components)
|
|
306
|
+
autorest.ts (sprint 100) SQL Workshop → RESTful Services (/builder/sql/rest): publish a table or view through an
|
|
307
|
+
application of the workspace (checks: schema the workshop may use, app role not the owner), its page
|
|
308
|
+
(grants per method, RLS, security_invoker, endpoints, cURL/fetch, OpenAPI link), settings, disable
|
|
309
|
+
rest-modules.ts (sprint 104) SQL Workshop → RESTful Services → Modules (/builder/sql/rest/modules): modules of the
|
|
310
|
+
workspace's applications, the module › template › handler tree, handler forms, Try it (inject with a
|
|
311
|
+
short-lived token), Run only / lock checks
|
|
262
312
|
workflows.ts workflow versions, diagram and instances (Shared Components)
|
|
263
313
|
process-jobs.ts page designer: the Jobs tab of a background chain process
|
|
264
314
|
template-spec.ts template component property form (Shared Components)
|
|
@@ -290,11 +340,15 @@ public/
|
|
|
290
340
|
app.css theme (light/dark, responsive; --font, --font-size, --radius for style variants; template option classes to-*)
|
|
291
341
|
app.js client runtime: dialogs (dialog_closed actions), popup LOVs, dynamic actions (focus, classes, messages), grids (add/duplicate rows, master-detail refresh, move/resize columns, copy/paste of cell ranges), menus, lazy regions, maps (Leaflet layers, marker clusters, heat layer, layer legend, area/distance filter) (no inline JS)
|
|
292
342
|
code-editor.js, .css builder code editor: enhances <textarea data-code>, highlighting, suggestions (no dependencies)
|
|
343
|
+
palette.js (sprint 96) the builder's search dialog (Ctrl+K), recently visited SQL Workshop pages, the Launchpad's tabs
|
|
344
|
+
sql-monitor.js (sprint 102) the SQL Monitor: reloads the sessions' live part every 5 / 15 / 60 s, Pause (localStorage pgkiln.sqlMonitor)
|
|
345
|
+
data-modeler.js, .css (sprint 98) the Data Modeler: drag boxes, undo/redo, save, zoom/fit, auto layout, mini-map, SVG/PNG export, print
|
|
293
346
|
worksheet.js, .css (sprint 91) the SQL Worksheet: run keys with the cursor, output tabs, navigator swap and search, drag and drop, splitters;
|
|
294
347
|
(92) grid sort, value dialog, history filter; (93) worksheet tabs in localStorage, Files, binds dialog, format, find, case
|
|
295
|
-
builder.css builder only: IDE look (dark chrome, icon rail, panes)
|
|
348
|
+
builder.css builder only: IDE look (dark chrome, icon rail, panes); design tokens at the top (colour,
|
|
349
|
+
elevation, radius, type, motion; light and dark sets, sprint 105), then the shared controls
|
|
296
350
|
builder.js builder only: tabs, component tree, property filter, drag and drop on the layout
|
|
297
|
-
builder-icons.svg builder only: icons of the rail, toolbar and designer (b-*)
|
|
351
|
+
builder-icons.svg builder only: icons of the rail, toolbar and designer (b-*); b-kiln is the brand mark (brandMark() in ui.ts)
|
|
298
352
|
test/
|
|
299
353
|
binds.test.ts unit tests
|
|
300
354
|
security.test.ts security regression tests (in-process, against the database)
|
|
@@ -311,9 +365,17 @@ test/
|
|
|
311
365
|
unload.test.ts Unload Data: CSV/JSON/XLSX/XML output, read back with Load Data, read-only and one-statement checks, streaming
|
|
312
366
|
app-from-file.test.ts Create → From a file: proposed names and types, app + table + rows + pages, row errors, login, validation
|
|
313
367
|
workshop.test.ts SQL scripts, Quick SQL pages, query builder, data load definitions (Load Data, the process, export)
|
|
368
|
+
cron-schedule.test.ts (sprint 101) pg_cron schedules: parsing and errors, next runs across time zones and daylight saving, words
|
|
369
|
+
scheduling.test.ts (sprint 101) SQL Workshop → Scheduling: the SQL, the no-pg_cron page, create/edit/disable/run now/unschedule,
|
|
370
|
+
history and purge; against pg_cron when the test database has it, else test/pgcron-mock.ts (a stand-in)
|
|
371
|
+
sql-charts.test.ts (sprint 97) the worksheet's Chart tab, saving a chart, the Charts dashboard, a chart's page, read-only runs
|
|
372
|
+
launchpad.test.ts (sprint 96) Launchpad groups, pins (builder pages only, at most 24), the search (JSON and page)
|
|
314
373
|
tabledef.test.ts (sprint 95) table definitions round trip: CREATE, read, ALTER, read again; mistakes
|
|
374
|
+
changelog.test.ts (sprint 106) DDL recognition and names, recording from Table Properties, the worksheet and Compare,
|
|
375
|
+
downloads (Flyway, Liquibase, SQL), stable numbers, the latest application export
|
|
315
376
|
table-editor.test.ts (sprint 95) the Table Properties page: preview, apply, a failing apply rolls back, template, worksheet
|
|
316
377
|
object-actions.test.ts (sprint 94) object menus: Quick DDL, Drop with dependents, Add index / trigger / policy, the panel, not-found
|
|
378
|
+
data-modeler.test.ts (sprint 98) Data Modeler: "hr core" with its FK lines, saved positions, SVG, objects, DDL, dictionary, geometry
|
|
317
379
|
worksheet.test.ts (sprint 91) the SQL Worksheet: statement at the cursor, Run Script log, plans, notices, history, navigator, Run as
|
|
318
380
|
quicksql.test.ts Quick SQL parser and DDL generator
|
|
319
381
|
xml.test.ts XML reader: rows, attributes, paths, refused DTDs and entities, limits
|
|
@@ -327,6 +389,7 @@ test/
|
|
|
327
389
|
charts.test.ts chart markup per kind (geometry as classes), gauges, Gantt time axis and dependencies, pyramid, polar, range, box plot, stock, drill-down links
|
|
328
390
|
calendar.test.ts calendar views, create links, moving events (pure and over HTTP)
|
|
329
391
|
rest-sources.test.ts REST data sources, web credentials, SSRF checks, invoke_api (mock service + HR page 23)
|
|
392
|
+
rest-modules.test.ts (sprint 104) modules, templates, PL/pgSQL and media handlers, OpenAPI, the builder's tree and Try it
|
|
330
393
|
workflow-invoke.test.ts workflow invoke_api steps: the call between transactions, faults, retry, lease, Advisor, export (mock service)
|
|
331
394
|
large-tables.test.ts row ranges, max_rows, row limits, lazy regions, region caching, streamed downloads (HR page 25)
|
|
332
395
|
grid.test.ts interactive grid: aggregates, layouts per user, saved grid reports, master-detail, row actions (HR page 27)
|
|
@@ -360,6 +423,7 @@ test/
|
|
|
360
423
|
helpers.ts a cookie-keeping test browser
|
|
361
424
|
e2e/responsive.test.ts browser tests at phone/tablet/desktop widths (Playwright)
|
|
362
425
|
e2e/code-editor.test.ts the code editor in a browser: highlighting, keys, suggestions, touch, screen readers
|
|
426
|
+
e2e/data-modeler.test.ts (sprint 98) the Data Modeler in a browser: drag, save, reload, undo/redo, zoom, mini-map, exports, phone
|
|
363
427
|
e2e/worksheet.test.ts (sprint 91) the SQL Worksheet in a browser: run keys, tabs, navigator, drag and drop, splitters, phone, no JavaScript
|
|
364
428
|
e2e/items.test.ts sprint 26 item types in a browser: editors, tags, stars, dates, reveal; without JavaScript
|
|
365
429
|
e2e/designer.test.ts page designer: panes per width, drag and drop, keyboard, Arrange buttons, builder theme
|