Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tam/pgsl
A superscript language of PostgreSQL
https://github.com/tam/pgsl
Last synced: about 1 month ago
JSON representation
A superscript language of PostgreSQL
- Host: GitHub
- URL: https://github.com/tam/pgsl
- Owner: Tam
- Created: 2021-05-10T22:34:42.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-05-14T17:28:39.000Z (7 months ago)
- Last Synced: 2024-05-15T13:20:35.048Z (7 months ago)
- Language: Rust
- Size: 75.2 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# pgsl
**P**ost**g**res **S**chema **L**anguage: a superscript language of PostgreSQLRemoves a lot of the guff in postgres files, making schemas easier to write and
understand at a glance.Will come with its own migrator so all you have to do is write the schema. The
migrator will check the structure of the database and only migrate any changes.
It will also warn about destructive actions (like dropping columns or enums).```text
# interfaces/archive.pglinterface table archive:
columns:
is_archived boolean default false
Whether or not this item is archived (soft-deleted)
@omit create
archived_at timestamptz
When this item was archived
@omit create,update
restored_at timestamptz
When this item was restored
@omit create,updatetrigger before insert or update on archive:
begin:
if old.is_archived = false and new.is_archived = true then
new.archived_at = now();
elsif old.is_archived = true and new.is_archived = false then
new.restored_at = now();
end if;return new;
end plpgsql volatile# character.pgl
require:
interfaces/archive
interfaces/timestamp
core
assets
gameschema character:
grant usage to anonymous, membertable public.character:
extends:
archive
timestamp
columns:
id uuid primary key default public.uuid_generate_v1mc()
owner_id uuid references public.user(id) on delete cascade
@omit
@description Hello world!
game_type text references game.type not null
name varchar(256) not null
token_id uuid references public.asset(id) on delete set nullfunction character.example_func:
accept:
id uuid
some_value text
declare:
another_value boolean
begin:
select * from test;
end sql stable
```