Add old includes

This commit is contained in:
Alvar C.H. Freude
2024-03-30 00:45:40 +01:00
parent a7d23a21ed
commit 8d5d979cba
13 changed files with 208 additions and 0 deletions

39
helper/README.md Normal file
View File

@ -0,0 +1,39 @@
# SQL-Helper-Files
PostgreSQL helper files for psql, for include via `\ir helper/....` in SQL files.
This helper files contains mostly command for setting permissions.
## Documentation, Usage
Common usage is to set some psql variables before include; some variables are usually global, others local for each call.
### Global variables:
```
-- Name Value
-- -------------------------------------------
\set schema my_project
\set db my_projectau
\set user_prefix my_project
\set owner :user_prefix _owner
\set default_reader :user_prefix _reader
\set default_updater :user_prefix _updater
\set default_inserter :user_prefix _inserter
```
### Local variables
Usually you have to set `table` or `function` to the name of the current table or function. Grant scripts include call of revoke scripts!
```
\set table last_created_table
\ir helper/20-grant-default-reader.sql
```