diff --git a/readme.md b/readme.md index 33b0345..949a7c0 100644 --- a/readme.md +++ b/readme.md @@ -1,8 +1,6 @@ -# Sindri +# sindri -## Zweck - -- Erstellung von Datenmodell-Skripten in verschiedenen Ausgabeformaten (MySQL, SQLite, …) auf Basis einer abstrakten Beschreibung +erstellt Datenmodell-Skripte in verschiedenen Ausgabe-Sprachen (MySQL, SQLite, …) auf Basis einer abstrakten Beschreibung ## Erstellung @@ -25,6 +23,7 @@ Beispiel-Nutzung: ```sh tools/build cd build + 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'; +``` + + +