Go to file
2025-09-23 01:23:22 +02:00
doc [add] example:sweets 2025-09-23 01:23:22 +02:00
lib/plankton [fix] postgresql 2024-10-25 11:26:43 +02:00
source [fix] output:other/jsonschema 2025-09-22 20:39:31 +02:00
tools [add] output:database:postgresql 2024-06-03 09:15:52 +02:00
.gitignore [ini] 2023-02-20 14:46:28 +01:00
readme.md [mod] readme 2025-09-22 21:41:31 +02:00
todo.md [fix] postgresql 2024-10-25 11:26:43 +02:00

sindri

erstellt Datenmodell-Skripte in verschiedenen Ausgabe-Sprachen (MySQL, SQLite, …) auf Basis einer abstrakten Beschreibung

Erstellung

Voraussetzungen

  • Typescript-Compiler
  • GNU Make

Anweisungen

  • tools/build ausführen

Dokumentation

Beispiel-Nutzung:

tools/build
cd build

cat ../doc/examples/contacts.sindri.json | ./sindri -f database:sqlite

… erzeugt:

CREATE TABLE
	`address`(
		`id` INTEGER PRIMARY KEY AUTOINCREMENT,
		`city` VARCHAR(255) NOT NULL,
		`zip` VARCHAR(255) NOT NULL,
		`street` VARCHAR(255) NOT NULL
	)
;

CREATE TABLE
	`person`(
		`id` INTEGER PRIMARY KEY AUTOINCREMENT,
		`prename` VARCHAR(255) NOT NULL,
		`surname` VARCHAR(255) NOT NULL,
		`address_id` INTEGER NOT NULL,
		`email_address` VARCHAR(255) DEFAULT NULL
	)
;

Der Befehl muss nur minimal gewändert werden um die PostgreSQL-Ausgabe zu erhalten:

cat ../doc/examples/contacts.sindri.json | ./sindri -f database:postgresql

… erzeugt:

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';