{ "tables": [ { "id": 0, "name": "users", "schema": "public", "comment": "User accounts", "color": "#3b82f6", "x": 100, "y": 100, "fields": [ { "id": 0, "name": "id", "type": "bigint", "primary": true, "notNull": true, "increment": true }, { "id": 1, "name": "email", "type": "varchar(255)", "unique": true, "notNull": true }, { "id": 2, "name": "username", "type": "varchar(50)", "notNull": true }, { "id": 3, "name": "created_at", "type": "timestamp", "notNull": true, "default": "CURRENT_TIMESTAMP" } ], "indexes": [ { "id": 0, "name": "idx_users_email", "unique": true, "fields": [1] } ] }, { "id": 1, "name": "posts", "schema": "public", "comment": "Blog posts", "color": "#10b981", "x": 400, "y": 100, "fields": [ { "id": 0, "name": "id", "type": "bigint", "primary": true, "notNull": true, "increment": true }, { "id": 1, "name": "user_id", "type": "bigint", "notNull": true }, { "id": 2, "name": "title", "type": "varchar(200)", "notNull": true }, { "id": 3, "name": "content", "type": "text" }, { "id": 4, "name": "published", "type": "boolean", "default": "false" } ], "indexes": [ { "id": 0, "name": "idx_posts_user_id", "unique": false, "fields": [1] } ] }, { "id": 2, "name": "comments", "schema": "public", "color": "#f59e0b", "x": 700, "y": 100, "fields": [ { "id": 0, "name": "id", "type": "bigint", "primary": true, "notNull": true, "increment": true }, { "id": 1, "name": "post_id", "type": "bigint", "notNull": true }, { "id": 2, "name": "user_id", "type": "bigint", "notNull": true }, { "id": 3, "name": "content", "type": "text", "notNull": true } ] } ], "relationships": [ { "id": 0, "name": "fk_posts_user", "startTableId": 1, "endTableId": 0, "startFieldId": 1, "endFieldId": 0, "cardinality": "Many to one", "updateConstraint": "CASCADE", "deleteConstraint": "CASCADE" }, { "id": 1, "name": "fk_comments_post", "startTableId": 2, "endTableId": 1, "startFieldId": 1, "endFieldId": 0, "cardinality": "Many to one", "deleteConstraint": "CASCADE" }, { "id": 2, "name": "fk_comments_user", "startTableId": 2, "endTableId": 0, "startFieldId": 2, "endFieldId": 0, "cardinality": "Many to one", "deleteConstraint": "SET NULL" } ], "notes": [ { "id": 0, "content": "Database: test_db", "color": "#fbbf24", "x": 100, "y": 400 } ] }