-- Script para criar o banco de dados e as tabelas

CREATE DATABASE IF NOT EXISTS rengoku_recepcao CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

USE rengoku_recepcao;

-- Tabela de visitantes
CREATE TABLE IF NOT EXISTS `visitors` (
  `id` INT AUTO_INCREMENT PRIMARY KEY,
  `full_name` VARCHAR(255) NOT NULL,
  `document_id` VARCHAR(50) DEFAULT NULL,
  `check_in` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  `check_out` TIMESTAMP NULL DEFAULT NULL,
  `destination` VARCHAR(255) NOT NULL,
  `registered_by` INT NOT NULL,
  FOREIGN KEY (`registered_by`) REFERENCES `users`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB;
