diff --git a/config/db-schema.json b/config/db-schema.json new file mode 100644 index 0000000..19c154f --- /dev/null +++ b/config/db-schema.json @@ -0,0 +1,125 @@ +{ + + "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)" } + }, + + "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)" } + }, + + "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)" } + }, + + "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" ] } + }, + + "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" ] } + }, + + "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)" } + }, + + "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" } + }, + + "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" ] } + }, + + "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