Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/billiegoose/make-it-so
"It appears to be some kind of advanced Data Definition Language" - Jean-Luc Picard
https://github.com/billiegoose/make-it-so
Last synced: about 1 month ago
JSON representation
"It appears to be some kind of advanced Data Definition Language" - Jean-Luc Picard
- Host: GitHub
- URL: https://github.com/billiegoose/make-it-so
- Owner: billiegoose
- License: isc
- Created: 2016-01-10T02:14:25.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2016-01-11T04:33:32.000Z (about 9 years ago)
- Last Synced: 2024-10-06T03:23:18.671Z (4 months ago)
- Language: PLpgSQL
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NOT READY FOR USE! (work in progress)
# Make-It-So — a declarative DDL for Postgresql
*"Make it so, number one!"* —Jean-Luc Picard
Mold your database to your will. I'm porting my psql-tools.sh collection
of shell scripts to a faster, more robust, more DRY collection of functions
written in plpgsql, and I'm just bold enough to make them publicly available
as a bona-fide Postgresql extension.## Installation:
1. Copy the .sql and .control files to /usr/share/postgresql/9.3/extension
(or whatever it is on your system).
2. Open `psql`
3. and run `CREATE EXTENSION make_it_so`## Functions:
make_table(name text)
- Ensure a table of that name exists. Will destroy views and materialized views in its way, but not indexes, TOAST tables, etc.make_column(tbl text, col text, typ text)
- Ensure tbl.col exists. (Currently doesn't check type.) If not, creates it of type typ.make_table_so(data json)
- Create / rename / track previously untracked table. Current values supported:
- uuid::String
- name::StringThe _inventory table:
| | uuid | name | oid |
|----------|:----:|:----:|:---:|
| JSON | ☑ | ☑ | ☐ |
| Postgres | ☐ | ☑ | ☑ |## Future functions:
make_it_so(definitions json)- Form all the database / schema / user / table / view / function from their definitions
### Form columns
make_column_so(table regclass, definitions json)
- name string (required)
- type string (required)
- default string|null (optional)
- is_not_null bool (optional)
- is_unique bool (optional)
- is_index bool (optional)### Form tables
make_table_so(definitions json)
- sets/unsets table attributes
- recursively calls make_column_so()### Form views
make_view_so(definitions json)
- name string (required)
- definition string (required)### Form functions
make_function_so(definition json)
- name string (required)
- language string (required)
- is_cachable bool (optional)
- is_volatile bool (optional)
- is_null_if_null_input bool (optional)
- definition string (required)