@wmfs/pg-model
Version:
Takes a relational database structure and returns model objects for noSQL-like abilities.
419 lines (418 loc) • 14.2 kB
JSON
{
"generated": "2017-05-22T21:41:15.243Z",
"schemas": {
"pgmodel_test": {
"schemaExistsInDatabase": true,
"comment": "Schema auto-generated by Relationize.js!",
"tables": {
"person": {
"comment": "Isn't this just a list of people?",
"pkColumnNames": [
"employee_no"
],
"columns": {
"employee_no": {
"columnDefault": null,
"isNullable": "NO",
"dataType": "text",
"characterMaximumLength": null,
"numericScale": null,
"comment": null
},
"first_name": {
"columnDefault": null,
"isNullable": "NO",
"dataType": "text",
"characterMaximumLength": null,
"numericScale": null,
"comment": "Person's first name"
},
"last_name": {
"columnDefault": null,
"isNullable": "NO",
"dataType": "text",
"characterMaximumLength": null,
"numericScale": null,
"comment": null
},
"age": {
"columnDefault": null,
"isNullable": "YES",
"dataType": "integer",
"characterMaximumLength": null,
"numericScale": 0,
"comment": "Age in years"
},
"_created": {
"columnDefault": "now()",
"isNullable": "NO",
"dataType": "timestamp with time zone",
"characterMaximumLength": null,
"numericScale": null,
"comment": "Timestamp for when this record was created"
},
"_created_by": {
"columnDefault": null,
"isNullable": "YES",
"dataType": "text",
"characterMaximumLength": null,
"numericScale": null,
"comment": "UserID that created this record (if known)"
},
"_modified": {
"columnDefault": "now()",
"isNullable": "NO",
"dataType": "timestamp with time zone",
"characterMaximumLength": null,
"numericScale": null,
"comment": "Timestamp for when this record was last updated"
},
"_modified_by": {
"columnDefault": null,
"isNullable": "YES",
"dataType": "text",
"characterMaximumLength": null,
"numericScale": null,
"comment": "UserID that last modified this record (if known)"
},
"date": {
"columnDefault": null,
"isNullable": "YES",
"dataType": "timestamp with time zone",
"characterMaximumLength": null,
"numericScale": null,
"comment": "Timestamp for testing finding by datetime"
}
},
"indexes": {
"person_first_name_last_name_idx": {
"columns": [
[
"first_name",
"last_name"
]
],
"unique": false
}
},
"fkConstraints": {}
},
"craters": {
"comment": "Auto-generated via Relationize.js!",
"pkColumnNames": [
"id"
],
"columns": {
"title": {
"columnDefault": null,
"isNullable": "NO",
"dataType": "text",
"characterMaximumLength": null,
"numericScale": null,
"comment": "The display-label of the crater"
},
"diameter": {
"columnDefault": null,
"isNullable": "YES",
"dataType": "integer",
"characterMaximumLength": null,
"numericScale": 0,
"comment": "Diameter of the crater, in metres"
},
"moons_id": {
"columnDefault": null,
"isNullable": "YES",
"dataType": "uuid",
"characterMaximumLength": null,
"numericScale": null,
"comment": "Auto-added foreign key for moons"
},
"id": {
"columnDefault": "uuid_generate_v1()",
"isNullable": "NO",
"dataType": "uuid",
"characterMaximumLength": null,
"numericScale": null,
"comment": "Automatically added UUID-based primary key column"
},
"_created": {
"columnDefault": "now()",
"isNullable": "NO",
"dataType": "timestamp with time zone",
"characterMaximumLength": null,
"numericScale": null,
"comment": "Timestamp for when this record was created"
},
"_created_by": {
"columnDefault": null,
"isNullable": "YES",
"dataType": "text",
"characterMaximumLength": null,
"numericScale": null,
"comment": "UserID that created this record (if known)"
},
"_modified": {
"columnDefault": "now()",
"isNullable": "NO",
"dataType": "timestamp with time zone",
"characterMaximumLength": null,
"numericScale": null,
"comment": "Timestamp for when this record was last updated"
},
"_modified_by": {
"columnDefault": null,
"isNullable": "YES",
"dataType": "text",
"characterMaximumLength": null,
"numericScale": null,
"comment": "UserID that last modified this record (if known)"
}
},
"indexes": {
"craters_moons_id_idx": {
"columns": [
[
"moons_id"
]
],
"unique": false
}
},
"fkConstraints": {
"craters_to_moons_fk": {
"targetTable": "pgmodel_test.moons",
"sourceColumns": [
"moons_id"
],
"targetColumns": [
"id"
],
"matchType": "SIMPLE",
"updateAction": "NO ACTION",
"deleteAction": "CASCADE"
}
}
},
"planets": {
"comment": "A list of planets",
"pkColumnNames": [
"name"
],
"columns": {
"name": {
"columnDefault": null,
"isNullable": "NO",
"dataType": "text",
"characterMaximumLength": null,
"numericScale": null,
"comment": "Unique planet name"
},
"title": {
"columnDefault": null,
"isNullable": "NO",
"dataType": "text",
"characterMaximumLength": null,
"numericScale": null,
"comment": "The display-label of the planet"
},
"type": {
"columnDefault": null,
"isNullable": "YES",
"dataType": "text",
"characterMaximumLength": null,
"numericScale": null,
"comment": "What type of planet is this?"
},
"diameter": {
"columnDefault": null,
"isNullable": "YES",
"dataType": "numeric",
"characterMaximumLength": null,
"numericScale": null,
"comment": "The diameter of the planet, in metres"
},
"color": {
"columnDefault": null,
"isNullable": "YES",
"dataType": "text",
"characterMaximumLength": null,
"numericScale": null,
"comment": "What color is this planet?"
},
"other_facts": {
"columnDefault": null,
"isNullable": "YES",
"dataType": "jsonb",
"characterMaximumLength": null,
"numericScale": 0,
"comment": "Additional info related to the planet"
},
"url": {
"columnDefault": null,
"isNullable": "YES",
"dataType": "text",
"characterMaximumLength": null,
"numericScale": null,
"comment": "Further reading available here!"
},
"_created": {
"columnDefault": "now()",
"isNullable": "NO",
"dataType": "timestamp with time zone",
"characterMaximumLength": null,
"numericScale": null,
"comment": "Timestamp for when this record was created"
},
"_created_by": {
"columnDefault": null,
"isNullable": "YES",
"dataType": "text",
"characterMaximumLength": null,
"numericScale": null,
"comment": "UserID that created this record (if known)"
},
"_modified": {
"columnDefault": "now()",
"isNullable": "NO",
"dataType": "timestamp with time zone",
"characterMaximumLength": null,
"numericScale": null,
"comment": "Timestamp for when this record was last updated"
},
"_modified_by": {
"columnDefault": null,
"isNullable": "YES",
"dataType": "text",
"characterMaximumLength": null,
"numericScale": null,
"comment": "UserID that last modified this record (if known)"
}
},
"indexes": {},
"fkConstraints": {}
},
"moons": {
"comment": "Auto-generated via Relationize.js!",
"pkColumnNames": [
"id"
],
"columns": {
"title": {
"columnDefault": null,
"isNullable": "NO",
"dataType": "text",
"characterMaximumLength": null,
"numericScale": null,
"comment": "The display-label of the moon"
},
"discovered_by": {
"columnDefault": null,
"isNullable": "YES",
"dataType": "text",
"characterMaximumLength": null,
"numericScale": null,
"comment": "Name of the person who discovered the moon"
},
"discovery_year": {
"columnDefault": null,
"isNullable": "YES",
"dataType": "integer",
"characterMaximumLength": null,
"numericScale": 0,
"comment": "Year the moon was discovered (e.g. 1804)"
},
"planets_name": {
"columnDefault": null,
"isNullable": "YES",
"dataType": "text",
"characterMaximumLength": null,
"numericScale": null,
"comment": "Auto-added foreign key for planets"
},
"id": {
"columnDefault": "uuid_generate_v1()",
"isNullable": "NO",
"dataType": "uuid",
"characterMaximumLength": null,
"numericScale": null,
"comment": "Automatically added UUID-based primary key column"
},
"_created": {
"columnDefault": "now()",
"isNullable": "NO",
"dataType": "timestamp with time zone",
"characterMaximumLength": null,
"numericScale": null,
"comment": "Timestamp for when this record was created"
},
"_created_by": {
"columnDefault": null,
"isNullable": "YES",
"dataType": "text",
"characterMaximumLength": null,
"numericScale": null,
"comment": "UserID that created this record (if known)"
},
"_modified": {
"columnDefault": "now()",
"isNullable": "NO",
"dataType": "timestamp with time zone",
"characterMaximumLength": null,
"numericScale": null,
"comment": "Timestamp for when this record was last updated"
},
"_modified_by": {
"columnDefault": null,
"isNullable": "YES",
"dataType": "text",
"characterMaximumLength": null,
"numericScale": null,
"comment": "UserID that last modified this record (if known)"
}
},
"indexes": {
"moons_planets_name_idx": {
"columns": [
[
"planets_name"
]
],
"unique": false
}
},
"fkConstraints": {
"moons_to_planets_fk": {
"targetTable": "pgmodel_test.planets",
"sourceColumns": [
"planets_name"
],
"targetColumns": [
"name"
],
"matchType": "SIMPLE",
"updateAction": "NO ACTION",
"deleteAction": "CASCADE"
}
}
}
},
"views": {
"peeps": {
"columns": {
"name": {
"array": false,
"isNullable": "YES",
"dataType": "text"
},
"employee_no": {
"array": false,
"isNullable": "YES",
"dataType": "text"
}
},
"sql": "SELECT person.employee_no, concat(person.first_name, ' ', person.last_name) AS name FROM pgmodel_test.person;"
}
}
}
}
}