text: # ************************************************************
  # Sequel Pro SQL dump
  # Version 5446
  #
  # https://www.sequelpro.com/
  # https://github.com/sequelpro/sequelpro
  #
  # Host: 127.0.0.1 (MySQL 5.5.5-10.5.9-MariaDB)
  # Database: logutt
  # Generation Time: 2021-06-01 12:01:24 +0000
  # ************************************************************
  /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */
  ;
  /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */
  ;
  /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */
  ;
  /*!40101 SET NAMES utf8 */
  ;
  SET NAMES utf8mb4;
  /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */
  ;
  /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */
  ;
  /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */
  ;
  drop TABLE `associations`;
  drop TABLE `categories`;
  drop TABLE `object_instances`;
  drop TABLE `objects`;
  drop TABLE `storage_spaces`;
  # Dump of table associations
  # ------------------------------------------------------------
  CREATE TABLE `associations` (
    `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
    `name` varchar(50) NOT NULL DEFAULT '',
    PRIMARY KEY (`id`)
  ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;
  # Dump of table categories
  # ------------------------------------------------------------
  CREATE TABLE `categories` (
    `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
    `name` varchar(50) NOT NULL DEFAULT '',
    `parent_id` int(10) unsigned DEFAULT NULL,
    `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
    `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
    PRIMARY KEY (`id`),
    KEY `parent_id` (`parent_id`),
    CONSTRAINT `categories_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `categories` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
  ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;
  # Dump of table object_instances
  # ------------------------------------------------------------
  CREATE TABLE `object_instances` (
    `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
    `identifier` varchar(30) DEFAULT NULL,
    `object_id` int(11) unsigned NOT NULL,
    `description` text DEFAULT NULL,
    `association_id` int(11) unsigned NOT NULL,
    `storage_id` int(10) unsigned NOT NULL,
    `storage_description` text DEFAULT NULL,
    `state` text DEFAULT NULL,
    `deposit` double DEFAULT NULL,
    `expiration` date DEFAULT NULL,
    `quantity` int(11) NOT NULL DEFAULT 1,
    `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
    `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
    PRIMARY KEY (`id`),
    KEY `object_id` (`object_id`),
    KEY `association_id` (`association_id`),
    KEY `storage_id` (`storage_id`),
    CONSTRAINT `object_instances_ibfk_1` FOREIGN KEY (`object_id`) REFERENCES `objects` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
    CONSTRAINT `object_instances_ibfk_2` FOREIGN KEY (`association_id`) REFERENCES `associations` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
    CONSTRAINT `object_instances_ibfk_3` FOREIGN KEY (`storage_id`) REFERENCES `storage_spaces` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
  ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;
  # Dump of table objects
  # ------------------------------------------------------------
  CREATE TABLE `objects` (
    `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
    `name` varchar(50) NOT NULL DEFAULT '',
    `description` text DEFAULT NULL,
    `category_id` int(11) unsigned DEFAULT NULL,
    `lendable` tinyint(1) NOT NULL DEFAULT 0,
    `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
    `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
    PRIMARY KEY (`id`),
    KEY `category_id` (`category_id`),
    CONSTRAINT `objects_ibfk_1` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
  ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;
  # Dump of table roles
  # ------------------------------------------------------------
  CREATE TABLE `roles` (
    `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
    `name` varchar(30) NOT NULL DEFAULT '',
    PRIMARY KEY (`id`)
  ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;
  # Dump of table storage_spaces
  # ------------------------------------------------------------
  CREATE TABLE `storage_spaces` (
    `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
    `name` varchar(50) NOT NULL DEFAULT '',
    `room` varchar(50) NOT NULL DEFAULT '',
    `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
    `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
    PRIMARY KEY (`id`)
  ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;
  # Dump of table users
  # ------------------------------------------------------------
  CREATE TABLE `users` (
    `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
    `first_name` varchar(30) DEFAULT NULL,
    `last_name` varchar(30) DEFAULT NULL,
    `email` varchar(50) DEFAULT NULL,
    `phone` int(11) DEFAULT NULL,
    `token` text DEFAULT NULL,
    PRIMARY KEY (`id`)
  ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;
  # Dump of table users_associations
  # ------------------------------------------------------------
  CREATE TABLE `users_associations` (
    `user_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
    `association_id` int(11) unsigned NOT NULL,
    `role_id` int(11) unsigned NOT NULL,
    PRIMARY KEY (`user_id`, `association_id`),
    KEY `association_id` (`association_id`),
    KEY `role_id` (`role_id`),
    CONSTRAINT `users_associations_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
    CONSTRAINT `users_associations_ibfk_2` FOREIGN KEY (`association_id`) REFERENCES `associations` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
    CONSTRAINT `users_associations_ibfk_3` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
  ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;
  /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */
  ;
  /*!40101 SET SQL_MODE=@OLD_SQL_MODE */
  ;
  /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */
  ;
  /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */
  ;
  /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */
  ;
  /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */
  ;