Created
October 28, 2015 17:16
-
-
Save anachronic/6d0cec9c96d7c702be85 to your computer and use it in GitHub Desktop.
export de tablas MySQL (sustentabilidad)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE `alertas_alarma` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`formula` longtext NOT NULL, | |
`email` varchar(100) NOT NULL, | |
`dispositivo_id` int(11) NOT NULL, | |
PRIMARY KEY (`id`), | |
KEY `a_dispositivo_id_46651386577e44c9_fk_dispositivos_dispositivo_id` (`dispositivo_id`), | |
CONSTRAINT `a_dispositivo_id_46651386577e44c9_fk_dispositivos_dispositivo_id` FOREIGN KEY (`dispositivo_id`) REFERENCES `dispositivos_dispositivo` (`id`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |
CREATE TABLE `auth_group` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`name` varchar(80) NOT NULL, | |
PRIMARY KEY (`id`), | |
UNIQUE KEY `name` (`name`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |
CREATE TABLE `auth_group_permissions` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`group_id` int(11) NOT NULL, | |
`permission_id` int(11) NOT NULL, | |
PRIMARY KEY (`id`), | |
UNIQUE KEY `group_id` (`group_id`,`permission_id`), | |
KEY `auth_group__permission_id_60ec384440049c66_fk_auth_permission_id` (`permission_id`), | |
CONSTRAINT `auth_group__permission_id_60ec384440049c66_fk_auth_permission_id` FOREIGN KEY (`permission_id`) REFERENCES `auth_permission` (`id`), | |
CONSTRAINT `auth_group_permission_group_id_511f0d6a0bf92fc4_fk_auth_group_id` FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |
CREATE TABLE `auth_permission` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`name` varchar(255) NOT NULL, | |
`content_type_id` int(11) NOT NULL, | |
`codename` varchar(100) NOT NULL, | |
PRIMARY KEY (`id`), | |
UNIQUE KEY `content_type_id` (`content_type_id`,`codename`), | |
CONSTRAINT `auth__content_type_id_6c3418bd7959bbac_fk_django_content_type_id` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`) | |
) ENGINE=InnoDB AUTO_INCREMENT=61 DEFAULT CHARSET=utf8; | |
CREATE TABLE `auth_user` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`password` varchar(128) NOT NULL, | |
`last_login` datetime(6) DEFAULT NULL, | |
`is_superuser` tinyint(1) NOT NULL, | |
`username` varchar(30) NOT NULL, | |
`first_name` varchar(30) NOT NULL, | |
`last_name` varchar(30) NOT NULL, | |
`email` varchar(254) NOT NULL, | |
`is_staff` tinyint(1) NOT NULL, | |
`is_active` tinyint(1) NOT NULL, | |
`date_joined` datetime(6) NOT NULL, | |
PRIMARY KEY (`id`), | |
UNIQUE KEY `username` (`username`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |
CREATE TABLE `auth_user_groups` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`user_id` int(11) NOT NULL, | |
`group_id` int(11) NOT NULL, | |
PRIMARY KEY (`id`), | |
UNIQUE KEY `user_id` (`user_id`,`group_id`), | |
KEY `auth_user_groups_group_id_673d4d2404c86e3c_fk_auth_group_id` (`group_id`), | |
CONSTRAINT `auth_user_groups_group_id_673d4d2404c86e3c_fk_auth_group_id` FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`), | |
CONSTRAINT `auth_user_groups_user_id_6865f0a5c1806e01_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |
CREATE TABLE `auth_user_user_permissions` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`user_id` int(11) NOT NULL, | |
`permission_id` int(11) NOT NULL, | |
PRIMARY KEY (`id`), | |
UNIQUE KEY `user_id` (`user_id`,`permission_id`), | |
KEY `auth_user_u_permission_id_2244e07cbed3ddf3_fk_auth_permission_id` (`permission_id`), | |
CONSTRAINT `auth_user_u_permission_id_2244e07cbed3ddf3_fk_auth_permission_id` FOREIGN KEY (`permission_id`) REFERENCES `auth_permission` (`id`), | |
CONSTRAINT `auth_user_user_permissi_user_id_5e65f565ed3d5cf4_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |
CREATE TABLE `dispositivos_canal` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`numero` int(11) NOT NULL, | |
`estado` varchar(1) NOT NULL, | |
`descripcion` varchar(100) NOT NULL, | |
`dispositivo_id` int(11) NOT NULL, | |
PRIMARY KEY (`id`), | |
KEY `dispositivos_canal_6b6050b7` (`dispositivo_id`), | |
CONSTRAINT `di_dispositivo_id_fa0cd47e8f2453d_fk_dispositivos_dispositivo_id` FOREIGN KEY (`dispositivo_id`) REFERENCES `dispositivos_dispositivo` (`id`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |
CREATE TABLE `dispositivos_datos` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`timestamp` datetime(6) NOT NULL, | |
`valor` int(11) NOT NULL, | |
`dispositivo_id` int(11) NOT NULL, | |
`tipo_dato_id` int(11) NOT NULL, | |
PRIMARY KEY (`id`), | |
KEY `dispositivos_datos_6b6050b7` (`dispositivo_id`), | |
KEY `dispositivos_datos_da44b1aa` (`tipo_dato_id`), | |
CONSTRAINT `di_dispositivo_id_fc3669b2298ae53_fk_dispositivos_dispositivo_id` FOREIGN KEY (`dispositivo_id`) REFERENCES `dispositivos_dispositivo` (`id`), | |
CONSTRAINT `disposi_tipo_dato_id_be12bc17edba5db_fk_dispositivos_tipodato_id` FOREIGN KEY (`tipo_dato_id`) REFERENCES `dispositivos_tipodato` (`id`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |
CREATE TABLE `dispositivos_dispositivo` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`descripcion` varchar(200) NOT NULL, | |
`serial` int(11) NOT NULL, | |
`email_encargado` varchar(200) NOT NULL, | |
`recinto_id` int(11) NOT NULL, | |
PRIMARY KEY (`id`), | |
KEY `dispositi_recinto_id_7f71cbaff23b4132_fk_organizacion_recinto_id` (`recinto_id`), | |
CONSTRAINT `dispositi_recinto_id_7f71cbaff23b4132_fk_organizacion_recinto_id` FOREIGN KEY (`recinto_id`) REFERENCES `organizacion_recinto` (`id`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |
CREATE TABLE `dispositivos_tipodato` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`magnitud` varchar(100) NOT NULL, | |
`unidad` varchar(100) NOT NULL, | |
PRIMARY KEY (`id`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |
CREATE TABLE `django_admin_log` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`action_time` datetime(6) NOT NULL, | |
`object_id` longtext, | |
`object_repr` varchar(200) NOT NULL, | |
`action_flag` smallint(5) unsigned NOT NULL, | |
`change_message` longtext NOT NULL, | |
`content_type_id` int(11) DEFAULT NULL, | |
`user_id` int(11) NOT NULL, | |
PRIMARY KEY (`id`), | |
KEY `djang_content_type_id_3fb74ee589aa8c87_fk_django_content_type_id` (`content_type_id`), | |
KEY `django_admin_log_user_id_16777ee64a2f8a53_fk_auth_user_id` (`user_id`), | |
CONSTRAINT `djang_content_type_id_3fb74ee589aa8c87_fk_django_content_type_id` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`), | |
CONSTRAINT `django_admin_log_user_id_16777ee64a2f8a53_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |
CREATE TABLE `django_content_type` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`app_label` varchar(100) NOT NULL, | |
`model` varchar(100) NOT NULL, | |
PRIMARY KEY (`id`), | |
UNIQUE KEY `django_content_type_app_label_9f030cdbf2a69ab_uniq` (`app_label`,`model`) | |
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8; | |
CREATE TABLE `django_migrations` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`app` varchar(255) NOT NULL, | |
`name` varchar(255) NOT NULL, | |
`applied` datetime(6) NOT NULL, | |
PRIMARY KEY (`id`) | |
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8; | |
CREATE TABLE `django_session` ( | |
`session_key` varchar(40) NOT NULL, | |
`session_data` longtext NOT NULL, | |
`expire_date` datetime(6) NOT NULL, | |
PRIMARY KEY (`session_key`), | |
KEY `django_session_de54fa62` (`expire_date`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |
CREATE TABLE `indicadores_indicador` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`nombre` varchar(200) NOT NULL, | |
`descripcion` varchar(200) NOT NULL, | |
`formula` longtext NOT NULL, | |
`es_grafico` tinyint(1) NOT NULL, | |
`dispositivo_id` int(11) DEFAULT NULL, | |
`tipo_dato_id` int(11) NOT NULL, | |
PRIMARY KEY (`id`), | |
KEY `i_dispositivo_id_38203546d729bcc3_fk_dispositivos_dispositivo_id` (`dispositivo_id`), | |
KEY `indica_tipo_dato_id_6cdf5216aae4c065_fk_dispositivos_tipodato_id` (`tipo_dato_id`), | |
CONSTRAINT `i_dispositivo_id_38203546d729bcc3_fk_dispositivos_dispositivo_id` FOREIGN KEY (`dispositivo_id`) REFERENCES `dispositivos_dispositivo` (`id`), | |
CONSTRAINT `indica_tipo_dato_id_6cdf5216aae4c065_fk_dispositivos_tipodato_id` FOREIGN KEY (`tipo_dato_id`) REFERENCES `dispositivos_tipodato` (`id`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |
CREATE TABLE `indicadores_variable` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`nombre` varchar(100) NOT NULL, | |
`valor` double NOT NULL, | |
PRIMARY KEY (`id`), | |
UNIQUE KEY `nombre` (`nombre`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |
CREATE TABLE `organizacion_institucion` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`nombre` varchar(200) NOT NULL, | |
`telefono` varchar(100) NOT NULL, | |
`email` varchar(100) NOT NULL, | |
PRIMARY KEY (`id`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |
CREATE TABLE `organizacion_local` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`nombre` varchar(200) NOT NULL, | |
`telefono` varchar(100) NOT NULL, | |
`email` varchar(100) NOT NULL, | |
`local_id` int(11) NOT NULL, | |
PRIMARY KEY (`id`), | |
KEY `organiz_local_id_110e8186b53d9bb1_fk_organizacion_institucion_id` (`local_id`), | |
CONSTRAINT `organiz_local_id_110e8186b53d9bb1_fk_organizacion_institucion_id` FOREIGN KEY (`local_id`) REFERENCES `organizacion_institucion` (`id`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |
CREATE TABLE `organizacion_recinto` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`nombre` varchar(200) NOT NULL, | |
`telefono` varchar(100) NOT NULL, | |
`email` varchar(100) NOT NULL, | |
`local_id` int(11) NOT NULL, | |
PRIMARY KEY (`id`), | |
KEY `organizacion__local_id_591a6ae4b3d5506f_fk_organizacion_local_id` (`local_id`), | |
CONSTRAINT `organizacion__local_id_591a6ae4b3d5506f_fk_organizacion_local_id` FOREIGN KEY (`local_id`) REFERENCES `organizacion_local` (`id`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |
CREATE TABLE `usuarios_rol` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`descripcion` varchar(255) NOT NULL, | |
PRIMARY KEY (`id`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |
CREATE TABLE `usuarios_tipousuario` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`nombre` varchar(100) NOT NULL, | |
PRIMARY KEY (`id`), | |
UNIQUE KEY `nombre` (`nombre`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |
CREATE TABLE `usuarios_tipousuario_roles` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`tipousuario_id` int(11) NOT NULL, | |
`rol_id` int(11) NOT NULL, | |
PRIMARY KEY (`id`), | |
UNIQUE KEY `tipousuario_id` (`tipousuario_id`,`rol_id`), | |
KEY `usuarios_tipousuario__rol_id_1bc1e825a9bf65d7_fk_usuarios_rol_id` (`rol_id`), | |
CONSTRAINT `usuar_tipousuario_id_6aeb389afab07054_fk_usuarios_tipousuario_id` FOREIGN KEY (`tipousuario_id`) REFERENCES `usuarios_tipousuario` (`id`), | |
CONSTRAINT `usuarios_tipousuario__rol_id_1bc1e825a9bf65d7_fk_usuarios_rol_id` FOREIGN KEY (`rol_id`) REFERENCES `usuarios_rol` (`id`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |
CREATE TABLE `usuarios_usuario` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`user` varchar(100) NOT NULL, | |
`password` varchar(100) NOT NULL, | |
`sal` varchar(100) NOT NULL, | |
`nombre` varchar(100) NOT NULL, | |
`apellido_paterno` varchar(100) DEFAULT NULL, | |
`apellido_materno` varchar(100) DEFAULT NULL, | |
`tipo_usuario_id` int(11) NOT NULL, | |
PRIMARY KEY (`id`), | |
KEY `usuarios_usuario_2bb0309c` (`tipo_usuario_id`), | |
CONSTRAINT `usua_tipo_usuario_id_5ed7cb5e4136afb6_fk_usuarios_tipousuario_id` FOREIGN KEY (`tipo_usuario_id`) REFERENCES `usuarios_tipousuario` (`id`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |
CREATE TABLE `visualizacion_permisoindicador` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`prioridad` int(11) NOT NULL, | |
`indicador_id` int(11) NOT NULL, | |
`usuario_id` int(11) NOT NULL, | |
PRIMARY KEY (`id`), | |
KEY `visual_indicador_id_79072d4ccb18947f_fk_indicadores_indicador_id` (`indicador_id`), | |
KEY `visualizacion_usuario_id_234ba1f47272e1b0_fk_usuarios_usuario_id` (`usuario_id`), | |
CONSTRAINT `visual_indicador_id_79072d4ccb18947f_fk_indicadores_indicador_id` FOREIGN KEY (`indicador_id`) REFERENCES `indicadores_indicador` (`id`), | |
CONSTRAINT `visualizacion_usuario_id_234ba1f47272e1b0_fk_usuarios_usuario_id` FOREIGN KEY (`usuario_id`) REFERENCES `usuarios_usuario` (`id`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment