CREATE TABLE "User" ( "id" int, "username" varchar(255), "password" varchar(255), "email" varchar(255), "created_at" datetime, "updated_at" datetime ); CREATE TABLE "Device" ( "id" int, "uuid" int, "user_id" int FOREIGN KEY("user_id") REFERENCES "User" ("id"), "created_at" datetime, "brand" varchar(255), "version" varchar(255), "operating_system" varchar(255), "model" varchar(255) ); CREATE TABLE "Permission" ( "id" int, "from_user_id" int FOREIGN KEY("from_user_id") REFERENCES "User" ("id"), "to_user_id" int FOREIGN KEY("to_user_id") REFERENCES "User" ("id"), "device_id" int FOREIGN KEY("device_id") REFERENCES "Device" ("id"), "created_at" datetime ); CREATE TABLE "Log" ( "id" int, "longitude" varchar(255), "device_id" int FOREIGN KEY("device_id") REFERENCES "Device" ("id"), "latitude" varchar(255), "timestamp" datetime );