From 9dbbc1e3dc6cd2d2e3e475daa25b050c402543a1 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Mon, 18 Sep 2017 16:48:43 +0200 Subject: [PATCH] added schema --- config/db-schema.json | 210 +++++++++++++++++++++--------------------- 1 file changed, 106 insertions(+), 104 deletions(-) diff --git a/config/db-schema.json b/config/db-schema.json index 19c154f..cdcb9ca 100644 --- a/config/db-schema.json +++ b/config/db-schema.json @@ -1,125 +1,127 @@ { + "default": { + "warehouse": { + "id_warehouse": { "type": "int", "primary": true, "auto_increment": true }, + "name": { "type": "varchar(30)" }, + "theme": { "type": "varchar(6)" }, + "password": { "type": "varchar(128)" }, + "token": { "type": "varchar(128)" } + }, - "warehouse": { - "id_warehouse": { "type": "int", "primary": true, "auto_increment": true }, - "name": { "type": "varchar(30)" }, - "theme": { "type": "varchar(6)" }, - "password": { "type": "varchar(128)" }, - "token": { "type": "varchar(128)" } - }, + "admin": { + "id_admin": { "type": "int", "primary": true, "auto_increment": true }, + "@id_warehouse": { "type": "int", "ref": [ "warehouse", "id_warehouse" ] }, + "username": { "type": "varchar(30)" }, + "mail": { "type": "varchar(50)" }, + "password": { "type": "varchar(128)" }, + "token": { "type": "varchar(128)" } + }, - "admin": { - "id_admin": { "type": "int", "primary": true, "auto_increment": true }, - "@id_warehouse": { "type": "int", "ref": [ "warehouse", "id_warehouse" ] }, - "username": { "type": "varchar(30)" }, - "mail": { "type": "varchar(50)" }, - "password": { "type": "varchar(128)" }, - "token": { "type": "varchar(128)" } - }, + "user": { + "id_user": { "type": "int", "primary": true, "auto_increment": true }, + "#id_warehouse": { "type": "int", "ref": [ "warehouse", "id_warehouse" ] }, + "code": { "type": "varchar(20)" }, + "username": { "type": "varchar(30)" }, + "firstname": { "type": "varchar(30)" }, + "lastname": { "type": "varchar(30)" }, + "mail": { "type": "varchar(50)" } + }, - "user": { - "id_user": { "type": "int", "primary": true, "auto_increment": true }, - "#id_warehouse": { "type": "int", "ref": [ "warehouse", "id_warehouse" ] }, - "code": { "type": "varchar(20)" }, - "username": { "type": "varchar(30)" }, - "firstname": { "type": "varchar(30)" }, - "lastname": { "type": "varchar(30)" }, - "mail": { "type": "varchar(50)" } - }, + "machine": { + "id_machine": { "type": "int", "primary": true, "auto_increment": true }, + "#id_warehouse": { "type": "int", "ref": [ "warehouse", "id_warehouse" ] }, + "name": { "type": "varchar(30)" }, + "token": { "type": "varchar(128)" }, + "unlock_code": { "type": "varchar(128)" }, + "ap": { "type": "varchar(30)" }, + "ip": { "type": "varchar(16)" } + }, - "machine": { - "id_machine": { "type": "int", "primary": true, "auto_increment": true }, - "#id_warehouse": { "type": "int", "ref": [ "warehouse", "id_warehouse" ] }, - "name": { "type": "varchar(30)" }, - "token": { "type": "varchar(128)" }, - "unlock_code": { "type": "varchar(128)" }, - "ap": { "type": "varchar(30)" }, - "ip": { "type": "varchar(16)" } - }, + "user_cluster": { + "id_user_cluster": { "type": "int", "primary": true, "auto_increment": true }, + "#id_warehouse": { "type": "int", "ref": [ "warehouse", "id_warehouse" ] }, + "name": { "type": "varchar(30)" } + }, - "user_cluster": { - "id_user_cluster": { "type": "int", "primary": true, "auto_increment": true }, - "#id_warehouse": { "type": "int", "ref": [ "warehouse", "id_warehouse" ] }, - "name": { "type": "varchar(30)" } - }, + "machine_cluster": { + "id_machine_cluster": { "type": "int", "primary": true, "auto_increment": true }, + "#id_warehouse": { "type": "int", "ref": [ "warehouse", "id_warehouse" ] }, + "name": { "type": "varchar(30)" } + }, - "machine_cluster": { - "id_machine_cluster": { "type": "int", "primary": true, "auto_increment": true }, - "#id_warehouse": { "type": "int", "ref": [ "warehouse", "id_warehouse" ] }, - "name": { "type": "varchar(30)" } - }, + "user_cluster_merge": { + "id_user_cluster_merge": { "type": "int", "primary": true, "auto_increment": true }, + "#id_user_cluster": { "type": "int", "ref": [ "user_cluster", "id_user_cluster" ] }, + "#id_user": { "type": "int", "ref": [ "user", "id_user" ] } + }, - "user_cluster_merge": { - "id_user_cluster_merge": { "type": "int", "primary": true, "auto_increment": true }, - "#id_user_cluster": { "type": "int", "ref": [ "user_cluster", "id_user_cluster" ] }, - "#id_user": { "type": "int", "ref": [ "user", "id_user" ] } - }, + "machine_cluster_merge": { + "id_machine_cluster_merge": { "type": "int", "primary": true, "auto_increment": true }, + "#id_machine_cluster": { "type": "int", "ref": [ "machine_cluster", "id_machine_cluster" ] }, + "#id_machine": { "type": "int", "ref": [ "machine", "id_machine" ] } + }, - "machine_cluster_merge": { - "id_machine_cluster_merge": { "type": "int", "primary": true, "auto_increment": true }, - "#id_machine_cluster": { "type": "int", "ref": [ "machine_cluster", "id_machine_cluster" ] }, - "#id_machine": { "type": "int", "ref": [ "machine", "id_machine" ] } - }, + "module": { + "id_module": { "type": "int", "primary": true, "auto_increment": true }, + "name": { "type": "varchar(50)" } + }, - "module": { - "id_module": { "type": "int", "primary": true, "auto_increment": true }, - "name": { "type": "varchar(50)" } - }, + "module_merge": { + "#id_warehouse": { "type": "int", "ref": [ "warehouse", "id_warehouse" ] }, + "#id_module": { "type": "int", "ref": [ "module", "id_module" ] } + }, - "module_merge": { - "#id_warehouse": { "type": "int", "ref": [ "warehouse", "id_warehouse" ] }, - "#id_module": { "type": "int", "ref": [ "module", "id_module" ] } - }, + "chip": { + "id_chip": { "type": "int", "primary": true, "auto_increment": true }, + "#id_module": { "type": "int", "ref": [ "module", "id_module" ] }, + "name": { "type": "varchar(20)" }, + "position": { "type": "int" }, + "type": { "type": "varchar(10)" } + }, - "chip": { - "id_chip": { "type": "int", "primary": true, "auto_increment": true }, - "#id_module": { "type": "int", "ref": [ "module", "id_module" ] }, - "name": { "type": "varchar(20)" }, - "position": { "type": "int" }, - "type": { "type": "varchar(10)" } - }, + "global_state": { + "id_global_state": { "type": "int", "primary": true, "auto_increment": true }, + "global_state": { "type": "varchar(20)" }, + "chips": { "type": "varchar(30)" } + }, - "global_state": { - "id_global_state": { "type": "int", "primary": true, "auto_increment": true }, - "global_state": { "type": "varchar(20)" }, - "chips": { "type": "varchar(30)" } - }, + "pin_merge": { + "id_pin_merge": { "type": "int", "primary": true, "auto_increment": true }, + "#id_chip": { "type": "int", "ref": [ "chip", "id_chip" ] }, + "pin": { "type": "int" }, + "type": { "type": "varchar(30)" } + }, - "pin_merge": { - "id_pin_merge": { "type": "int", "primary": true, "auto_increment": true }, - "#id_chip": { "type": "int", "ref": [ "chip", "id_chip" ] }, - "pin": { "type": "int" }, - "type": { "type": "varchar(30)" } - }, + "state": { + "id_state": { "type": "int", "primary": true, "auto_increment": true }, + "#id_pin_merge": { "type": "int", "ref": [ "pin_merge", "id_pin_merge" ] }, + "state": { "type": "varchar(1)" }, + "value": { "type": "int" } + }, - "state": { - "id_state": { "type": "int", "primary": true, "auto_increment": true }, - "#id_pin_merge": { "type": "int", "ref": [ "pin_merge", "id_pin_merge" ] }, - "state": { "type": "varchar(1)" }, - "value": { "type": "int" } - }, + "action": { + "id_action": { "type": "int", "primary": true, "auto_increment": true }, + "name": { "type": "varchar(30)" }, + "timeout": { "type": "int" }, + "previous": { "type": "varchar(20)" }, + "action": { "type": "varchar(20)" } + }, - "action": { - "id_action": { "type": "int", "primary": true, "auto_increment": true }, - "name": { "type": "varchar(30)" }, - "timeout": { "type": "int" }, - "previous": { "type": "varchar(20)" }, - "action": { "type": "varchar(20)" } - }, + "action_merge": { + "id_action_merge": { "type": "int", "primary": true, "auto_increment": true }, + "#id_target": { "type": "int", "ref": [ "machine_cluster", "id_machine_cluster" ] }, + "#id_source": { "type": "int", "ref": [ "user_cluster", "id_user_cluster" ] }, + "#id_action": { "type": "int", "ref": [ "action", "id_action" ] } + }, - "action_merge": { - "id_action_merge": { "type": "int", "primary": true, "auto_increment": true }, - "#id_target": { "type": "int", "ref": [ "machine_cluster", "id_machine_cluster" ] }, - "#id_source": { "type": "int", "ref": [ "user_cluster", "id_user_cluster" ] }, - "#id_action": { "type": "int", "ref": [ "action", "id_action" ] } - }, + "history": { + "id_history": { "type": "int", "primary": true, "auto_increment": true }, + "timestamp": { "type": "int" }, + "#id_user": { "type": "int", "ref": [ "user", "id_user" ] }, + "#id_machine": { "type": "int", "ref": [ "machine", "id_machine" ] }, + "#id_action": { "type": "int", "ref": [ "action", "id_action" ] } + } - "history": { - "id_history": { "type": "int", "primary": true, "auto_increment": true }, - "timestamp": { "type": "int" }, - "#id_user": { "type": "int", "ref": [ "user", "id_user" ] }, - "#id_machine": { "type": "int", "ref": [ "machine", "id_machine" ] }, - "#id_action": { "type": "int", "ref": [ "action", "id_action" ] } } } \ No newline at end of file