ircd.sql 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525
  1. -- phpMyAdmin SQL Dump
  2. -- version 4.0.4.1
  3. -- http://www.phpmyadmin.net
  4. --
  5. -- Host: 127.0.0.1
  6. -- Generation Time: Feb 20, 2014 at 02:10 AM
  7. -- Server version: 5.6.11
  8. -- PHP Version: 5.5.3
  9. SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
  10. SET AUTOCOMMIT = 0;
  11. START TRANSACTION;
  12. SET time_zone = "+00:00";
  13. /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
  14. /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
  15. /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
  16. /*!40101 SET NAMES utf8 */;
  17. --
  18. -- Database: `ircd`
  19. --
  20. CREATE DATABASE IF NOT EXISTS `ircd` DEFAULT CHARACTER SET latin1 COLLATE latin1_general_ci;
  21. USE `ircd`;
  22. -- --------------------------------------------------------
  23. --
  24. -- Stand-in structure for view `children_v`
  25. --
  26. DROP VIEW IF EXISTS `children_v`;
  27. CREATE TABLE IF NOT EXISTS `children_v` (
  28. `user_id` int(100)
  29. ,`parent_id` int(100)
  30. ,`child_id` int(100)
  31. );
  32. -- --------------------------------------------------------
  33. --
  34. -- Table structure for table `configuration`
  35. --
  36. -- Creation: Feb 19, 2014 at 10:35 PM
  37. --
  38. DROP TABLE IF EXISTS `configuration`;
  39. CREATE TABLE IF NOT EXISTS `configuration` (
  40. `key` varchar(100) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  41. `description` varchar(100) NOT NULL,
  42. `value` varchar(4000) DEFAULT NULL,
  43. `type` varchar(100) NOT NULL,
  44. PRIMARY KEY (`key`),
  45. UNIQUE KEY `key` (`key`),
  46. KEY `key_2` (`key`)
  47. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  48. --
  49. -- Dumping data for table `configuration`
  50. --
  51. INSERT INTO `configuration` (`key`, `description`, `value`, `type`) VALUES
  52. ('2-factor-method', '2-Factor Method', 'none', 'list'),
  53. ('authy-api-key', 'Authy API Key', NULL, 'string'),
  54. ('authy-endpoint', 'Authy Endpoint', 'http://sandbox-api.authy.com', 'list'),
  55. ('irc-port', 'Main Server Port', '6667', 'number'),
  56. ('irc-server', 'Main Server IP', NULL, 'lookup'),
  57. ('mibbit-password', 'Mibbit Password', NULL, 'string'),
  58. ('ops-channel', 'Opers Channel', '#opers', 'string'),
  59. ('persona-audience', 'Persona Audience', NULL, 'string'),
  60. ('persona-endpoint', 'Persona Endpoint', 'none', 'list'),
  61. ('rehash-pass', 'RehashServ Password', NULL, 'string'),
  62. ('server-pass', 'Server-to-Server Password', NULL, 'string'),
  63. ('services-server', 'Services Server', NULL, 'lookup'),
  64. ('stats-server', 'Stats Server', NULL, 'lookup'),
  65. ('xmlrpc-path', 'XMLRPC Path', '/xmlrpc', 'string'),
  66. ('xmlrpc-port', 'XMLRPC Port', '9900', 'number'),
  67. ('xmlrpc-server', 'XMLRPC Server', NULL, 'lookup');
  68. -- --------------------------------------------------------
  69. --
  70. -- Table structure for table `configuration_lists`
  71. --
  72. -- Creation: Feb 19, 2014 at 10:35 PM
  73. --
  74. DROP TABLE IF EXISTS `configuration_lists`;
  75. CREATE TABLE IF NOT EXISTS `configuration_lists` (
  76. `id` int(100) NOT NULL AUTO_INCREMENT,
  77. `key` varchar(100) COLLATE latin1_general_ci NOT NULL,
  78. `value` varchar(4000) COLLATE latin1_general_ci NOT NULL,
  79. `label` varchar(100) COLLATE latin1_general_ci NOT NULL,
  80. PRIMARY KEY (`id`),
  81. KEY `key` (`key`)
  82. ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=8 ;
  83. --
  84. -- RELATIONS FOR TABLE `configuration_lists`:
  85. -- `key`
  86. -- `configuration` -> `key`
  87. --
  88. --
  89. -- Dumping data for table `configuration_lists`
  90. --
  91. INSERT INTO `configuration_lists` (`id`, `key`, `value`, `label`) VALUES
  92. (1, '2-factor-method', 'none', '(none)'),
  93. (2, '2-factor-method', 'google-authenticator', 'Google Authenticator'),
  94. (3, '2-factor-method', 'authy', 'Authy'),
  95. (4, 'authy-endpoint', 'https://api.authy.com', 'Production'),
  96. (5, 'authy-endpoint', 'http://sandbox-api.authy.com', 'Sandbox'),
  97. (6, 'persona-endpoint', 'none', '(none)'),
  98. (7, 'persona-endpoint', 'https://verifier.login.persona.org/verify', 'Production');
  99. -- --------------------------------------------------------
  100. --
  101. -- Table structure for table `configuration_lookups`
  102. --
  103. -- Creation: Feb 19, 2014 at 10:35 PM
  104. --
  105. DROP TABLE IF EXISTS `configuration_lookups`;
  106. CREATE TABLE IF NOT EXISTS `configuration_lookups` (
  107. `id` int(100) NOT NULL AUTO_INCREMENT,
  108. `key` varchar(100) COLLATE latin1_general_ci NOT NULL,
  109. `table` varchar(100) COLLATE latin1_general_ci NOT NULL,
  110. `column` varchar(100) COLLATE latin1_general_ci NOT NULL,
  111. `label_column` varchar(100) COLLATE latin1_general_ci NOT NULL,
  112. `enabled_column` varchar(100) COLLATE latin1_general_ci DEFAULT NULL,
  113. PRIMARY KEY (`id`),
  114. KEY `configuration_key` (`key`)
  115. ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=5 ;
  116. --
  117. -- RELATIONS FOR TABLE `configuration_lookups`:
  118. -- `key`
  119. -- `configuration` -> `key`
  120. --
  121. --
  122. -- Dumping data for table `configuration_lookups`
  123. --
  124. INSERT INTO `configuration_lookups` (`id`, `key`, `table`, `column`, `label_column`, `enabled_column`) VALUES
  125. (1, 'irc-server', 'servers', 'ip', 'name', '!uline'),
  126. (2, 'services-server', 'servers', 'host', 'name', 'uline'),
  127. (3, 'stats-server', 'servers', 'host', 'name', 'uline'),
  128. (4, 'xmlrpc-server', 'servers', 'ip', 'name', 'uline');
  129. -- --------------------------------------------------------
  130. --
  131. -- Table structure for table `emails`
  132. --
  133. -- Creation: Feb 19, 2014 at 10:35 PM
  134. --
  135. DROP TABLE IF EXISTS `emails`;
  136. CREATE TABLE IF NOT EXISTS `emails` (
  137. `id` int(100) NOT NULL AUTO_INCREMENT,
  138. `user_id` int(100) NOT NULL,
  139. `email` varchar(100) COLLATE latin1_general_ci NOT NULL,
  140. PRIMARY KEY (`id`),
  141. UNIQUE KEY `email` (`email`),
  142. KEY `user_id` (`user_id`)
  143. ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=16 ;
  144. --
  145. -- RELATIONS FOR TABLE `emails`:
  146. -- `user_id`
  147. -- `users` -> `id`
  148. --
  149. -- --------------------------------------------------------
  150. --
  151. -- Table structure for table `hosts`
  152. --
  153. -- Creation: Feb 19, 2014 at 10:35 PM
  154. --
  155. DROP TABLE IF EXISTS `hosts`;
  156. CREATE TABLE IF NOT EXISTS `hosts` (
  157. `id` int(100) NOT NULL AUTO_INCREMENT,
  158. `oper_id` int(100) NOT NULL,
  159. `host` varchar(100) NOT NULL,
  160. PRIMARY KEY (`id`),
  161. KEY `oper_id` (`oper_id`)
  162. ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=20 ;
  163. --
  164. -- RELATIONS FOR TABLE `hosts`:
  165. -- `oper_id`
  166. -- `opers` -> `id`
  167. --
  168. -- --------------------------------------------------------
  169. --
  170. -- Table structure for table `opers`
  171. --
  172. -- Creation: Feb 19, 2014 at 10:35 PM
  173. --
  174. DROP TABLE IF EXISTS `opers`;
  175. CREATE TABLE IF NOT EXISTS `opers` (
  176. `id` int(100) NOT NULL AUTO_INCREMENT,
  177. `nick` varchar(20) NOT NULL,
  178. `role_id` int(11) NOT NULL,
  179. `user_id` int(100) NOT NULL,
  180. `manager_id` int(100) NOT NULL,
  181. `server_id` int(100) DEFAULT NULL,
  182. `password` varchar(100) NOT NULL,
  183. `password_type_id` int(100) NOT NULL,
  184. `swhois` varchar(100) DEFAULT NULL,
  185. PRIMARY KEY (`id`),
  186. UNIQUE KEY `id` (`id`),
  187. UNIQUE KEY `nick` (`nick`),
  188. KEY `id_2` (`id`),
  189. KEY `nick_2` (`nick`),
  190. KEY `role_id` (`role_id`),
  191. KEY `password_type_id` (`password_type_id`),
  192. KEY `user_id` (`manager_id`),
  193. KEY `server_id` (`server_id`),
  194. KEY `user_id_2` (`user_id`)
  195. ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ;
  196. --
  197. -- RELATIONS FOR TABLE `opers`:
  198. -- `password_type_id`
  199. -- `password_type` -> `id`
  200. -- `server_id`
  201. -- `servers` -> `id`
  202. -- `role_id`
  203. -- `oper_roles` -> `id`
  204. -- `manager_id`
  205. -- `users` -> `id`
  206. --
  207. -- --------------------------------------------------------
  208. --
  209. -- Stand-in structure for view `opers_v`
  210. --
  211. DROP VIEW IF EXISTS `opers_v`;
  212. CREATE TABLE IF NOT EXISTS `opers_v` (
  213. `id` int(100)
  214. ,`user_id` int(100)
  215. ,`manager_id` int(100)
  216. ,`server_id` int(100)
  217. ,`nick` varchar(20)
  218. ,`password` varchar(100)
  219. ,`password_type` varchar(100)
  220. ,`swhois` varchar(100)
  221. ,`flags` varchar(4000)
  222. ,`role` varchar(20)
  223. );
  224. -- --------------------------------------------------------
  225. --
  226. -- Table structure for table `oper_roles`
  227. --
  228. -- Creation: Feb 19, 2014 at 10:35 PM
  229. --
  230. DROP TABLE IF EXISTS `oper_roles`;
  231. CREATE TABLE IF NOT EXISTS `oper_roles` (
  232. `id` int(100) NOT NULL AUTO_INCREMENT,
  233. `name` varchar(20) NOT NULL,
  234. `flags` varchar(4000) NOT NULL,
  235. PRIMARY KEY (`id`),
  236. UNIQUE KEY `name` (`name`)
  237. ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
  238. --
  239. -- Dumping data for table `oper_roles`
  240. --
  241. INSERT INTO `oper_roles` (`id`, `name`, `flags`) VALUES
  242. (1, 'netadmin', 'netadmin;\ncan_restart;\ncan_die;\ncan_gkline;\ncan_zline;\ncan_gzline;\ncan_override;\ncan_addline;\nget_host;'),
  243. (2, 'global', 'global;\ncan_override;\ncan_setq;\ncan_addline;\ncan_dccdeny;\nget_host;'),
  244. (3, 'servicesadmin', 'services-admin;\r\ncan_override;\r\ncan_setq;\r\ncan_addline;\r\ncan_dccdeny;\r\nget_host;');
  245. -- --------------------------------------------------------
  246. --
  247. -- Table structure for table `password_type`
  248. --
  249. -- Creation: Feb 19, 2014 at 10:35 PM
  250. --
  251. DROP TABLE IF EXISTS `password_type`;
  252. CREATE TABLE IF NOT EXISTS `password_type` (
  253. `id` int(100) NOT NULL AUTO_INCREMENT,
  254. `name` varchar(100) NOT NULL,
  255. PRIMARY KEY (`id`),
  256. UNIQUE KEY `name` (`name`)
  257. ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
  258. --
  259. -- Dumping data for table `password_type`
  260. --
  261. INSERT INTO `password_type` (`id`, `name`) VALUES
  262. (1, 'md5'),
  263. (2, 'sha1');
  264. -- --------------------------------------------------------
  265. --
  266. -- Table structure for table `servers`
  267. --
  268. -- Creation: Feb 19, 2014 at 10:35 PM
  269. --
  270. DROP TABLE IF EXISTS `servers`;
  271. CREATE TABLE IF NOT EXISTS `servers` (
  272. `id` int(100) NOT NULL AUTO_INCREMENT,
  273. `name` varchar(100) NOT NULL,
  274. `host` varchar(100) NOT NULL,
  275. `description` varchar(4000) NOT NULL,
  276. `parent_id` int(100) DEFAULT NULL,
  277. `user_id` int(100) NOT NULL,
  278. `ip` varchar(15) NOT NULL,
  279. `uline` tinyint(1) NOT NULL DEFAULT '0',
  280. PRIMARY KEY (`id`),
  281. UNIQUE KEY `name` (`name`,`host`),
  282. KEY `parent_id` (`parent_id`),
  283. KEY `user_id` (`user_id`)
  284. ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ;
  285. --
  286. -- RELATIONS FOR TABLE `servers`:
  287. -- `parent_id`
  288. -- `servers` -> `id`
  289. -- `user_id`
  290. -- `users` -> `id`
  291. --
  292. -- --------------------------------------------------------
  293. --
  294. -- Stand-in structure for view `ulines_v`
  295. --
  296. DROP VIEW IF EXISTS `ulines_v`;
  297. CREATE TABLE IF NOT EXISTS `ulines_v` (
  298. `id` int(100)
  299. ,`host` varchar(100)
  300. );
  301. -- --------------------------------------------------------
  302. --
  303. -- Table structure for table `users`
  304. --
  305. -- Creation: Feb 19, 2014 at 10:35 PM
  306. --
  307. DROP TABLE IF EXISTS `users`;
  308. CREATE TABLE IF NOT EXISTS `users` (
  309. `id` int(100) NOT NULL AUTO_INCREMENT,
  310. `api_key` varchar(24) NOT NULL,
  311. `secret_key` varchar(100) DEFAULT NULL,
  312. `password` varchar(40) NOT NULL,
  313. `real_name` varchar(50) NOT NULL,
  314. `nick` varchar(20) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  315. `email` varchar(100) NOT NULL,
  316. PRIMARY KEY (`id`),
  317. UNIQUE KEY `api_key` (`api_key`),
  318. UNIQUE KEY `nick` (`nick`),
  319. KEY `authy_id` (`secret_key`)
  320. ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;
  321. --
  322. -- Dumping data for table `users`
  323. --
  324. INSERT INTO `users` (`id`, `api_key`, `secret_key`, `password`, `real_name`, `nick`, `email`) VALUES
  325. (7, '1', NULL, '$Dj94pkis$Fs5kyCo4ocTT7zh8asWNJwIelP0=', 'root', 'root', '');
  326. -- --------------------------------------------------------
  327. --
  328. -- Table structure for table `user_roles`
  329. --
  330. -- Creation: Feb 19, 2014 at 10:35 PM
  331. --
  332. DROP TABLE IF EXISTS `user_roles`;
  333. CREATE TABLE IF NOT EXISTS `user_roles` (
  334. `id` int(100) NOT NULL AUTO_INCREMENT,
  335. `user_id` int(100) NOT NULL,
  336. `user_role_id` int(100) NOT NULL,
  337. PRIMARY KEY (`id`),
  338. KEY `user_id` (`user_id`,`user_role_id`),
  339. KEY `user_role_id` (`user_role_id`)
  340. ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=14 ;
  341. --
  342. -- RELATIONS FOR TABLE `user_roles`:
  343. -- `user_id`
  344. -- `users` -> `id`
  345. -- `user_role_id`
  346. -- `user_role_types` -> `id`
  347. --
  348. --
  349. -- Dumping data for table `user_roles`
  350. --
  351. INSERT INTO `user_roles` (`id`, `user_id`, `user_role_id`) VALUES
  352. (13, 7, 4);
  353. -- --------------------------------------------------------
  354. --
  355. -- Table structure for table `user_role_types`
  356. --
  357. -- Creation: Feb 19, 2014 at 10:35 PM
  358. --
  359. DROP TABLE IF EXISTS `user_role_types`;
  360. CREATE TABLE IF NOT EXISTS `user_role_types` (
  361. `id` int(100) NOT NULL AUTO_INCREMENT,
  362. `name` varchar(100) NOT NULL,
  363. `description` varchar(100) NOT NULL,
  364. `flags` varchar(3) NOT NULL DEFAULT 'o',
  365. PRIMARY KEY (`id`),
  366. UNIQUE KEY `name` (`name`),
  367. UNIQUE KEY `description` (`description`)
  368. ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
  369. --
  370. -- Dumping data for table `user_role_types`
  371. --
  372. INSERT INTO `user_role_types` (`id`, `name`, `description`, `flags`) VALUES
  373. (1, 'oper', 'Oper', 'o'),
  374. (2, 'admin', 'Server Manager', 'n'),
  375. (3, 'netadmin', 'Network Admin', 'on'),
  376. (4, 'globaladmin', 'Global Admin', 'nao');
  377. -- --------------------------------------------------------
  378. --
  379. -- Structure for view `children_v`
  380. --
  381. DROP TABLE IF EXISTS `children_v`;
  382. CREATE ALGORITHM=UNDEFINED DEFINER=`eeems`@`localhost` SQL SECURITY DEFINER VIEW `children_v` AS select `p`.`user_id` AS `user_id`,`p`.`id` AS `parent_id`,`c`.`id` AS `child_id` from (`servers` `c` left join `servers` `p` on((`p`.`id` = `c`.`parent_id`))) where ((`p`.`user_id` is not null) and (`c`.`user_id` is not null) and (`c`.`parent_id` is not null) and (`c`.`uline` = 0));
  383. -- --------------------------------------------------------
  384. --
  385. -- Structure for view `opers_v`
  386. --
  387. DROP TABLE IF EXISTS `opers_v`;
  388. CREATE ALGORITHM=UNDEFINED DEFINER=`eeems`@`localhost` SQL SECURITY DEFINER VIEW `opers_v` AS select `o`.`id` AS `id`,`o`.`user_id` AS `user_id`,`o`.`manager_id` AS `manager_id`,`o`.`server_id` AS `server_id`,`o`.`nick` AS `nick`,`o`.`password` AS `password`,`p`.`name` AS `password_type`,`o`.`swhois` AS `swhois`,`r`.`flags` AS `flags`,`r`.`name` AS `role` from ((`opers` `o` join `oper_roles` `r` on((`r`.`id` = `o`.`role_id`))) join `password_type` `p` on((`p`.`id` = `o`.`password_type_id`)));
  389. -- --------------------------------------------------------
  390. --
  391. -- Structure for view `ulines_v`
  392. --
  393. DROP TABLE IF EXISTS `ulines_v`;
  394. CREATE ALGORITHM=UNDEFINED DEFINER=`eeems`@`localhost` SQL SECURITY DEFINER VIEW `ulines_v` AS select `s`.`id` AS `id`,`s`.`host` AS `host` from `servers` `s` where (`s`.`uline` = 1);
  395. --
  396. -- Constraints for dumped tables
  397. --
  398. --
  399. -- Constraints for table `configuration_lists`
  400. --
  401. ALTER TABLE `configuration_lists`
  402. ADD CONSTRAINT `configuration_lists_ibfk_1` FOREIGN KEY (`key`) REFERENCES `configuration` (`key`) ON DELETE CASCADE ON UPDATE CASCADE;
  403. --
  404. -- Constraints for table `configuration_lookups`
  405. --
  406. ALTER TABLE `configuration_lookups`
  407. ADD CONSTRAINT `configuration_lookups_ibfk_1` FOREIGN KEY (`key`) REFERENCES `configuration` (`key`) ON DELETE CASCADE ON UPDATE CASCADE;
  408. --
  409. -- Constraints for table `emails`
  410. --
  411. ALTER TABLE `emails`
  412. ADD CONSTRAINT `emails_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
  413. --
  414. -- Constraints for table `hosts`
  415. --
  416. ALTER TABLE `hosts`
  417. ADD CONSTRAINT `hosts_ibfk_1` FOREIGN KEY (`oper_id`) REFERENCES `opers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
  418. --
  419. -- Constraints for table `opers`
  420. --
  421. ALTER TABLE `opers`
  422. ADD CONSTRAINT `opers_ibfk_2` FOREIGN KEY (`password_type_id`) REFERENCES `password_type` (`id`),
  423. ADD CONSTRAINT `opers_ibfk_4` FOREIGN KEY (`server_id`) REFERENCES `servers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  424. ADD CONSTRAINT `opers_ibfk_5` FOREIGN KEY (`role_id`) REFERENCES `oper_roles` (`id`),
  425. ADD CONSTRAINT `opers_ibfk_6` FOREIGN KEY (`manager_id`) REFERENCES `users` (`id`);
  426. --
  427. -- Constraints for table `servers`
  428. --
  429. ALTER TABLE `servers`
  430. ADD CONSTRAINT `servers_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `servers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  431. ADD CONSTRAINT `servers_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
  432. --
  433. -- Constraints for table `user_roles`
  434. --
  435. ALTER TABLE `user_roles`
  436. ADD CONSTRAINT `user_roles_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  437. ADD CONSTRAINT `user_roles_ibfk_2` FOREIGN KEY (`user_role_id`) REFERENCES `user_role_types` (`id`) ON UPDATE CASCADE;
  438. COMMIT;
  439. /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
  440. /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
  441. /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;