-- MySQL Workbench Synchronization
-- Generated: 2015-06-27 13:45
-- Model: New Model
-- Version: 1.0
-- Project: Name of the project
-- Author: WHK
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
CREATE TABLE IF NOT EXISTS `blank`.`sedes` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`campus` VARCHAR(512) NOT NULL,
`direccion` VARCHAR(512) NOT NULL,
PRIMARY KEY (`id`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci;
CREATE TABLE IF NOT EXISTS `blank`.`sedes_telefonos` (
`sede_id` INT(11) NOT NULL,
`codigo_pais` INT(11) NOT NULL,
`codigo_ciudad` INT(11) NOT NULL,
`numero` INT(11) NOT NULL,
`es_fijo` TINYINT(1) NOT NULL DEFAULT 0,
PRIMARY KEY (`sede_id`),
CONSTRAINT `fk_sedes_telefonos_sede`
FOREIGN KEY (`sede_id`)
REFERENCES `blank`.`sedes` (`id`)
ON DELETE CASCADE
ON UPDATE CASCADE)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci;
CREATE TABLE IF NOT EXISTS `blank`.`usuarios` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`nombres` VARCHAR(45) NOT NULL,
`apellidos` VARCHAR(45) NOT NULL,
`direccion` VARCHAR(512) NOT NULL,
PRIMARY KEY (`id`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci;
CREATE TABLE IF NOT EXISTS `blank`.`usuarios_telefonos` (
`usuario_id` INT(11) NOT NULL AUTO_INCREMENT,
`codigo_pais` INT(11) NOT NULL,
`codigo_ciudad` INT(11) NOT NULL,
`numero` INT(11) NOT NULL,
`es_fijo` TINYINT(1) NOT NULL DEFAULT 0,
PRIMARY KEY (`usuario_id`),
CONSTRAINT `fk_usuarios_telefonos_usuarios1`
FOREIGN KEY (`usuario_id`)
REFERENCES `blank`.`usuarios` (`id`)
ON DELETE CASCADE
ON UPDATE CASCADE)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci;
CREATE TABLE IF NOT EXISTS `blank`.`correos` (
`usuario_id` INT(11) NOT NULL,
`correo` VARCHAR(65) NOT NULL,
PRIMARY KEY (`usuario_id`),
CONSTRAINT `fk_usuarios_correos_usuarios1`
FOREIGN KEY (`usuario_id`)
REFERENCES `blank`.`usuarios` (`id`)
ON DELETE CASCADE
ON UPDATE CASCADE)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci;
CREATE TABLE IF NOT EXISTS `blank`.`usuarios_sedes_relacion` (
`usuario_id` INT(11) NOT NULL,
`sede_id` INT(11) NOT NULL,
PRIMARY KEY (`usuario_id`, `sede_id`),
INDEX `fk_usuarios_sedes_relacion_sede1_idx` (`sede_id` ASC),
CONSTRAINT `fk_usuarios_sedes_relacion_usuarios1`
FOREIGN KEY (`usuario_id`)
REFERENCES `blank`.`usuarios` (`id`)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT `fk_usuarios_sedes_relacion_sede1`
FOREIGN KEY (`sede_id`)
REFERENCES `blank`.`sedes` (`id`)
ON DELETE CASCADE
ON UPDATE CASCADE)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci;
CREATE TABLE IF NOT EXISTS `blank`.`usuarios_roles` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`nombres` VARCHAR(45) NOT NULL,
PRIMARY KEY (`id`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci;
CREATE TABLE IF NOT EXISTS `blank`.`usuarios_roles_relacion` (
`usuario_id` INT(11) NOT NULL,
`usuarios_rol_id` INT(11) NOT NULL,
PRIMARY KEY (`usuario_id`, `usuarios_rol_id`),
INDEX `fk_usuarios_roles_relacion_usuarios_roles1_idx` (`usuarios_rol_id` ASC),
CONSTRAINT `fk_usuarios_roles_relacion_usuarios1`
FOREIGN KEY (`usuario_id`)
REFERENCES `blank`.`usuarios` (`id`)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT `fk_usuarios_roles_relacion_usuarios_roles1`
FOREIGN KEY (`usuarios_rol_id`)
REFERENCES `blank`.`usuarios_roles` (`id`)
ON DELETE CASCADE
ON UPDATE CASCADE)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci;
CREATE TABLE IF NOT EXISTS `blank`.`alumnos_datos` (
`usuario_id` INT(11) NOT NULL,
`carrera_id` INT(11) NOT NULL,
PRIMARY KEY (`usuario_id`, `carrera_id`),
INDEX `fk_alumnos_datos_carreras1_idx` (`carrera_id` ASC),
CONSTRAINT `fk_alumnos_datos_usuarios1`
FOREIGN KEY (`usuario_id`)
REFERENCES `blank`.`usuarios` (`id`)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT `fk_alumnos_datos_carreras1`
FOREIGN KEY (`carrera_id`)
REFERENCES `blank`.`carreras` (`id`)
ON DELETE CASCADE
ON UPDATE CASCADE)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci;
CREATE TABLE IF NOT EXISTS `blank`.`carreras` (
`id` INT(11) NOT NULL,
`nombre` VARCHAR(45) NOT NULL,
PRIMARY KEY (`id`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci;
CREATE TABLE IF NOT EXISTS `blank`.`administrativo_datos` (
`usuario_id` INT(11) NOT NULL,
`cargo_id` INT(11) NOT NULL,
PRIMARY KEY (`usuario_id`, `cargo_id`),
INDEX `fk_administrativo_datos_cargos1_idx` (`cargo_id` ASC),
CONSTRAINT `fk_administrativo_datos_cargos1`
FOREIGN KEY (`cargo_id`)
REFERENCES `blank`.`cargos` (`int`)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT `fk_administrativo_datos_usuarios1`
FOREIGN KEY (`usuario_id`)
REFERENCES `blank`.`usuarios` (`id`)
ON DELETE CASCADE
ON UPDATE CASCADE)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci;
CREATE TABLE IF NOT EXISTS `blank`.`cargos` (
`int` INT(11) NOT NULL AUTO_INCREMENT,
`nombre` VARCHAR(45) NOT NULL,
PRIMARY KEY (`int`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci;
CREATE TABLE IF NOT EXISTS `blank`.`catedraticos_datos` (
`usuario_id` INT(11) NOT NULL,
`asignatura_id` INT(11) NOT NULL,
PRIMARY KEY (`usuario_id`, `asignatura_id`),
INDEX `fk_catedraticos_asignaturas1_idx` (`asignatura_id` ASC),
CONSTRAINT `fk_catedraticos_asignaturas1`
FOREIGN KEY (`asignatura_id`)
REFERENCES `blank`.`asignaturas` (`id`)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT `fk_catedraticos_usuarios1`
FOREIGN KEY (`usuario_id`)
REFERENCES `blank`.`usuarios` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci;
CREATE TABLE IF NOT EXISTS `blank`.`asignaturas` (
`id` INT(11) NOT NULL,
`nombre` VARCHAR(45) NOT NULL,
PRIMARY KEY (`id`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;