[mod] readme

This commit is contained in:
Christian Fraß 2025-09-22 21:41:31 +02:00
parent f7f763aba7
commit a4f000a64a

View file

@ -1,8 +1,6 @@
# Sindri # sindri
## Zweck erstellt Datenmodell-Skripte in verschiedenen Ausgabe-Sprachen (MySQL, SQLite, …) auf Basis einer abstrakten Beschreibung
- Erstellung von Datenmodell-Skripten in verschiedenen Ausgabeformaten (MySQL, SQLite, …) auf Basis einer abstrakten Beschreibung
## Erstellung ## Erstellung
@ -25,6 +23,7 @@ Beispiel-Nutzung:
```sh ```sh
tools/build tools/build
cd build cd build
cat ../doc/examples/contacts.sindri.json | ./sindri -f database:sqlite cat ../doc/examples/contacts.sindri.json | ./sindri -f database:sqlite
``` ```
@ -51,3 +50,45 @@ CREATE TABLE
; ;
``` ```
Der Befehl muss nur minimal gewändert werden um die PostgreSQL-Ausgabe zu erhalten:
```sh
cat ../doc/examples/contacts.sindri.json | ./sindri -f database:postgresql
```
… erzeugt:
```sql
CREATE TABLE
address(
"id" SERIAL,
"city" VARCHAR(255) NOT NULL,
"zip" VARCHAR(255) NOT NULL,
"street" VARCHAR(255) NOT NULL,
UNIQUE ("id")
)
;
COMMENT ON TABLE address IS 'collection of addresses';
COMMENT ON COLUMN address.city IS 'the name of the city';
COMMENT ON COLUMN address.zip IS 'the postal code';
COMMENT ON COLUMN address.street IS 'the name of the street and the house number';
CREATE TABLE
person(
"id" SERIAL,
"prename" VARCHAR(255) NOT NULL,
"surname" VARCHAR(255) NOT NULL,
"address_id" INTEGER NOT NULL,
"email_address" VARCHAR(255) DEFAULT NULL,
UNIQUE ("id")
)
;
COMMENT ON TABLE person IS 'collection of contacts';
COMMENT ON COLUMN person.prename IS 'first name of the person';
COMMENT ON COLUMN person.surname IS 'last name of the person';
COMMENT ON COLUMN person.address_id IS 'reference to the associated address dataset';
COMMENT ON COLUMN person.email_address IS 'optional eMail address';
```