/*
 Navicat Premium Data Transfer

 Source Server         : LOCAL
 Source Server Type    : MySQL
 Source Server Version : 80022
 Source Host           : localhost:3308
 Source Schema         : locadora_vazia

 Target Server Type    : MySQL
 Target Server Version : 80022
 File Encoding         : 65001

 Date: 09/03/2025 20:39:47
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for dependentes
-- ----------------------------
DROP TABLE IF EXISTS `dependentes`;
CREATE TABLE `dependentes`  (
  `id` int(0) NOT NULL AUTO_INCREMENT,
  `Matricula` int(15) UNSIGNED ZEROFILL NOT NULL,
  `Nome` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
  `Endereco` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
  `Bairro` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
  `Cidade` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'Rio de Janeiro',
  `UF` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'RJ',
  `CEP` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
  `Email` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
  `Telefone` varchar(14) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
  `Nascimento` date NULL DEFAULT NULL,
  `Data_Cadastro` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0),
  `Atualizado` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0),
  PRIMARY KEY (`id`, `Matricula`) USING BTREE,
  INDEX `FK_DEPENDENTES_TITULARES`(`Matricula`) USING BTREE,
  CONSTRAINT `FK_DEPENDENTES_TITULARES` FOREIGN KEY (`Matricula`) REFERENCES `titulares` (`Matricula`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 126948 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for documentacao
-- ----------------------------
DROP TABLE IF EXISTS `documentacao`;
CREATE TABLE `documentacao`  (
  `id` int(0) NOT NULL AUTO_INCREMENT,
  `Matricula` int(15) UNSIGNED ZEROFILL NOT NULL,
  `CPF` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `CNH` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
  `RG` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
  `Cartao` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
  `CVV2` varchar(6) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
  `Expiracao` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
  `Data_Cadastro` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0),
  `Atualizado` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0),
  PRIMARY KEY (`id`, `Matricula`, `CPF`) USING BTREE,
  INDEX `FK_TITULARES_DOCUMENTACAO`(`Matricula`) USING BTREE,
  CONSTRAINT `FK_TITULARES_DOCUMENTACAO` FOREIGN KEY (`Matricula`) REFERENCES `titulares` (`Matricula`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 38818 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for filmes
-- ----------------------------
DROP TABLE IF EXISTS `filmes`;
CREATE TABLE `filmes`  (
  `id` int(0) NOT NULL AUTO_INCREMENT,
  `Matricula_Locatario` int(15) UNSIGNED ZEROFILL NULL DEFAULT NULL,
  `Status` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'Disponivel',
  `Nome` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `Titulo_Original` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
  `Diretor` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `Ano` int(0) NOT NULL,
  `Genero` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `Franquia` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
  `classificacao` int(0) NULL DEFAULT NULL,
  `Sinopse` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL,
  `Pais` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
  `Oscar` int(0) NULL DEFAULT NULL,
  `Globo_de_Ouro` int(0) NULL DEFAULT NULL,
  `Data_Cadastro` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0),
  `Atualizado` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0),
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `FK_FILMES_TITULARES`(`Matricula_Locatario`) USING BTREE,
  CONSTRAINT `FK_FILMES_TITULARES` FOREIGN KEY (`Matricula_Locatario`) REFERENCES `titulares` (`Matricula`) ON DELETE SET NULL ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 10249 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for titulares
-- ----------------------------
DROP TABLE IF EXISTS `titulares`;
CREATE TABLE `titulares`  (
  `id` int(0) NOT NULL AUTO_INCREMENT,
  `Matricula` int(15) UNSIGNED ZEROFILL NOT NULL,
  `Nome` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
  `Endereco` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
  `Bairro` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
  `Cidade` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'Rio de Janeiro',
  `UF` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'RJ',
  `CEP` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
  `Email` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
  `Telefone` varchar(14) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
  `Nascimento` date NULL DEFAULT NULL,
  `Data_Cadastro` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0),
  `Atualizado` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0),
  PRIMARY KEY (`id`, `Matricula`) USING BTREE,
  INDEX `Matricula`(`Matricula`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 38818 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;

SET FOREIGN_KEY_CHECKS = 1;
