summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2010-10-12 21:43:39 -0400
committerAdam <Adam@anope.org>2010-10-12 21:43:39 -0400
commitdc0c07b408e0d31f39355e1ab28cb7751d531d90 (patch)
tree86f6e0f7b32ca6eef0d38d0878dd11d691ab327a /data
parentafb55a1842e57bc6a4b61e70c047ea57597c5a69 (diff)
Made the SQL tables use foriegn keys and references to each other, removed many now unnecessary queries from db_mysql
Diffstat (limited to 'data')
-rw-r--r--data/mysql/tables.sql332
1 files changed, 206 insertions, 126 deletions
diff --git a/data/mysql/tables.sql b/data/mysql/tables.sql
index 6b9c41b89..c9a781876 100644
--- a/data/mysql/tables.sql
+++ b/data/mysql/tables.sql
@@ -1,16 +1,30 @@
+-- phpMyAdmin SQL Dump
+-- version 3.3.5
+-- http://www.phpmyadmin.net
+--
+-- Host: localhost
+-- Generation Time: Oct 12, 2010 at 06:36 PM
+-- Server version: 5.1.50
+-- PHP Version: 5.2.14-pl0-gentoo
+
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
--
+-- Database: `anope`
+--
+
+-- --------------------------------------------------------
+
+--
-- Table structure for table `anope_bs_badwords`
--
-DROP TABLE IF EXISTS `anope_bs_badwords`;
CREATE TABLE IF NOT EXISTS `anope_bs_badwords` (
- `channel` varchar(255) NOT NULL default '',
+ `channel` varchar(255) NOT NULL DEFAULT '',
`word` varchar(255) NOT NULL,
`type` varchar(50) NOT NULL,
UNIQUE KEY `channel` (`channel`,`word`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -18,17 +32,16 @@ CREATE TABLE IF NOT EXISTS `anope_bs_badwords` (
-- Table structure for table `anope_bs_core`
--
-DROP TABLE IF EXISTS `anope_bs_core`;
CREATE TABLE IF NOT EXISTS `anope_bs_core` (
- `nick` varchar(255) NOT NULL default '',
- `user` varchar(255) NOT NULL default '',
+ `nick` varchar(255) NOT NULL DEFAULT '',
+ `user` varchar(255) NOT NULL DEFAULT '',
`host` text NOT NULL,
`rname` text NOT NULL,
`flags` text NOT NULL,
- `created` int(10) unsigned NOT NULL default '0',
- `chancount` int(11) NOT NULL default '0',
- PRIMARY KEY (`nick`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+ `created` int(10) unsigned NOT NULL DEFAULT '0',
+ `chancount` int(11) NOT NULL DEFAULT '0',
+ PRIMARY KEY (`nick`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -36,12 +49,12 @@ CREATE TABLE IF NOT EXISTS `anope_bs_core` (
-- Table structure for table `anope_bs_info_metadata`
--
-DROP TABLE IF EXISTS `anope_bs_info_metadata`;
CREATE TABLE IF NOT EXISTS `anope_bs_info_metadata` (
- `botname` varchar(255) NOT NULL default '',
- `name` varchar(255) NOT NULL default '',
- `value` text NOT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+ `botname` varchar(255) NOT NULL DEFAULT '',
+ `name` varchar(255) NOT NULL DEFAULT '',
+ `value` text NOT NULL,
+ KEY `FK_anope_bs_info_metadata_botname` (`botname`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -49,15 +62,14 @@ CREATE TABLE IF NOT EXISTS `anope_bs_info_metadata` (
-- Table structure for table `anope_cs_access`
--
-DROP TABLE IF EXISTS `anope_cs_access`;
CREATE TABLE IF NOT EXISTS `anope_cs_access` (
- `level` int(11) NOT NULL default '0',
- `display` varchar(255) NOT NULL default '',
- `channel` varchar(255) NOT NULL default '',
- `last_seen` int(10) unsigned NOT NULL default '0',
- `creator` varchar(255) NOT NULL default '',
+ `level` int(11) NOT NULL DEFAULT '0',
+ `display` varchar(255) NOT NULL DEFAULT '',
+ `channel` varchar(255) NOT NULL DEFAULT '',
+ `last_seen` int(10) unsigned NOT NULL DEFAULT '0',
+ `creator` varchar(255) NOT NULL DEFAULT '',
UNIQUE KEY `channel` (`channel`,`display`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -65,17 +77,16 @@ CREATE TABLE IF NOT EXISTS `anope_cs_access` (
-- Table structure for table `anope_cs_akick`
--
-DROP TABLE IF EXISTS `anope_cs_akick`;
CREATE TABLE IF NOT EXISTS `anope_cs_akick` (
- `channel` varchar(255) NOT NULL default '',
- `flags` varchar(255) NOT NULL default '',
- `mask` varchar(255) NOT NULL default '',
+ `channel` varchar(255) NOT NULL DEFAULT '',
+ `flags` varchar(255) NOT NULL DEFAULT '',
+ `mask` varchar(255) NOT NULL DEFAULT '',
`reason` text NOT NULL,
- `creator` varchar(255) NOT NULL default '',
- `created` int(10) unsigned NOT NULL default '0',
- `last_used` int(10) unsigned NOT NULL default '0',
+ `creator` varchar(255) NOT NULL DEFAULT '',
+ `created` int(10) unsigned NOT NULL DEFAULT '0',
+ `last_used` int(10) unsigned NOT NULL DEFAULT '0',
UNIQUE KEY `channel` (`channel`,`mask`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -83,35 +94,34 @@ CREATE TABLE IF NOT EXISTS `anope_cs_akick` (
-- Table structure for table `anope_cs_info`
--
-DROP TABLE IF EXISTS `anope_cs_info`;
CREATE TABLE IF NOT EXISTS `anope_cs_info` (
- `name` varchar(255) NOT NULL default '',
+ `name` varchar(255) NOT NULL DEFAULT '',
`founder` text NOT NULL,
`successor` text NOT NULL,
`descr` text NOT NULL,
- `time_registered` int(10) unsigned NOT NULL default '0',
- `last_used` int(10) unsigned NOT NULL default '0',
+ `time_registered` int(10) unsigned NOT NULL DEFAULT '0',
+ `last_used` int(10) unsigned NOT NULL DEFAULT '0',
`last_topic` text NOT NULL,
`last_topic_setter` text NOT NULL,
- `last_topic_time` int(10) unsigned NOT NULL default '0',
+ `last_topic_time` int(10) unsigned NOT NULL DEFAULT '0',
`flags` text NOT NULL,
`forbidby` text NOT NULL,
`forbidreason` text NOT NULL,
- `bantype` smallint(6) NOT NULL default '0',
+ `bantype` smallint(6) NOT NULL DEFAULT '0',
`mlock_on` text NOT NULL,
`mlock_off` text NOT NULL,
`mlock_params` text NOT NULL,
`entry_message` text NOT NULL,
- `memomax` smallint(5) unsigned NOT NULL default '0',
- `botnick` varchar(255) NOT NULL default '',
+ `memomax` smallint(5) unsigned NOT NULL DEFAULT '0',
+ `botnick` varchar(255) NOT NULL DEFAULT '',
`botflags` text NOT NULL,
- `capsmin` smallint(6) NOT NULL default '0',
- `capspercent` smallint(6) NOT NULL default '0',
- `floodlines` smallint(6) NOT NULL default '0',
- `floodsecs` smallint(6) NOT NULL default '0',
- `repeattimes` smallint(6) NOT NULL default '0',
- PRIMARY KEY (`name`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+ `capsmin` smallint(6) NOT NULL DEFAULT '0',
+ `capspercent` smallint(6) NOT NULL DEFAULT '0',
+ `floodlines` smallint(6) NOT NULL DEFAULT '0',
+ `floodsecs` smallint(6) NOT NULL DEFAULT '0',
+ `repeattimes` smallint(6) NOT NULL DEFAULT '0',
+ PRIMARY KEY (`name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -119,12 +129,12 @@ CREATE TABLE IF NOT EXISTS `anope_cs_info` (
-- Table structure for table `anope_cs_info_metadata`
--
-DROP TABLE IF EXISTS `anope_cs_info_metadata`;
CREATE TABLE IF NOT EXISTS `anope_cs_info_metadata` (
- `channel` varchar(255) NOT NULL default '',
- `name` varchar(255) NOT NULL default '',
- `value` text NOT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+ `channel` varchar(255) NOT NULL DEFAULT '',
+ `name` varchar(255) NOT NULL DEFAULT '',
+ `value` text NOT NULL,
+ KEY `FK_anope_cs_info_metadata_channel` (`channel`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -132,13 +142,12 @@ CREATE TABLE IF NOT EXISTS `anope_cs_info_metadata` (
-- Table structure for table `anope_cs_levels`
--
-DROP TABLE IF EXISTS `anope_cs_levels`;
CREATE TABLE IF NOT EXISTS `anope_cs_levels` (
- `channel` varchar(255) NOT NULL default '',
- `position` int(11) NOT NULL default '0',
- `level` int(11) NOT NULL default '0',
+ `channel` varchar(255) NOT NULL DEFAULT '',
+ `position` int(11) NOT NULL DEFAULT '0',
+ `level` int(11) NOT NULL DEFAULT '0',
UNIQUE KEY `channel` (`channel`,`position`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -146,13 +155,12 @@ CREATE TABLE IF NOT EXISTS `anope_cs_levels` (
-- Table structure for table `anope_cs_ttb`
--
-DROP TABLE IF EXISTS `anope_cs_ttb`;
CREATE TABLE IF NOT EXISTS `anope_cs_ttb` (
- `channel` varchar(255) NOT NULL default '',
- `ttb_id` int(11) NOT NULL default '0',
- `value` int(11) NOT NULL default '0',
+ `channel` varchar(255) NOT NULL DEFAULT '',
+ `ttb_id` int(11) NOT NULL DEFAULT '0',
+ `value` int(11) NOT NULL DEFAULT '0',
UNIQUE KEY `channel` (`channel`,`ttb_id`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -160,10 +168,9 @@ CREATE TABLE IF NOT EXISTS `anope_cs_ttb` (
-- Table structure for table `anope_extra`
--
-DROP TABLE IF EXISTS `anope_extra`;
CREATE TABLE IF NOT EXISTS `anope_extra` (
`data` text NOT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -171,11 +178,10 @@ CREATE TABLE IF NOT EXISTS `anope_extra` (
-- Table structure for table `anope_info`
--
-DROP TABLE IF EXISTS `anope_info`;
CREATE TABLE IF NOT EXISTS `anope_info` (
- `version` int(11) default NULL,
- `date` datetime default NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+ `version` int(11) DEFAULT NULL,
+ `date` datetime DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -183,16 +189,16 @@ CREATE TABLE IF NOT EXISTS `anope_info` (
-- Table structure for table `anope_ms_info`
--
-DROP TABLE IF EXISTS `anope_ms_info`;
CREATE TABLE IF NOT EXISTS `anope_ms_info` (
`receiver` varchar(255) NOT NULL,
- `number` int(11) NOT NULL default '0',
- `flags` int(11) NOT NULL default '0',
- `time` int(10) unsigned NOT NULL default '0',
+ `number` int(11) NOT NULL DEFAULT '0',
+ `flags` int(11) NOT NULL DEFAULT '0',
+ `time` int(10) unsigned NOT NULL DEFAULT '0',
`sender` text NOT NULL,
`text` blob NOT NULL,
- `serv` enum('NICK','CHAN') NOT NULL default 'NICK'
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+ `serv` enum('NICK','CHAN') NOT NULL DEFAULT 'NICK',
+ KEY `FK_anope_ms_info_receiver` (`receiver`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -200,11 +206,11 @@ CREATE TABLE IF NOT EXISTS `anope_ms_info` (
-- Table structure for table `anope_ns_access`
--
-DROP TABLE IF EXISTS `anope_ns_access`;
CREATE TABLE IF NOT EXISTS `anope_ns_access` (
- `display` varchar(255) NOT NULL default '',
- `access` varchar(160) NOT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+ `display` varchar(255) NOT NULL DEFAULT '',
+ `access` varchar(160) NOT NULL,
+ KEY `FK_anope_ns_access_display` (`display`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -212,18 +218,18 @@ CREATE TABLE IF NOT EXISTS `anope_ns_access` (
-- Table structure for table `anope_ns_alias`
--
-DROP TABLE IF EXISTS `anope_ns_alias`;
CREATE TABLE IF NOT EXISTS `anope_ns_alias` (
- `nick` varchar(255) NOT NULL default '',
+ `nick` varchar(255) NOT NULL DEFAULT '',
`last_quit` text NOT NULL,
`last_realname` text NOT NULL,
`last_usermask` text NOT NULL,
- `time_registered` int(10) unsigned NOT NULL default '0',
- `last_seen` int(10) unsigned NOT NULL default '0',
+ `time_registered` int(10) unsigned NOT NULL DEFAULT '0',
+ `last_seen` int(10) unsigned NOT NULL DEFAULT '0',
`flags` text NOT NULL,
- `display` varchar(255) NOT NULL default '',
- PRIMARY KEY (`nick`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+ `display` varchar(255) NOT NULL DEFAULT '',
+ PRIMARY KEY (`nick`),
+ KEY `FK_anope_ns_alias_display` (`display`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -231,13 +237,13 @@ CREATE TABLE IF NOT EXISTS `anope_ns_alias` (
-- Table structure for table `anope_ns_alias_metadata`
--
-DROP TABLE IF EXISTS `anope_ns_alias_metadata`;
CREATE TABLE IF NOT EXISTS `anope_ns_alias_metadata` (
- `nick` varchar(255) NOT NULL default '',
- `name` varchar(255) NOT NULL default '',
+ `nick` varchar(255) NOT NULL DEFAULT '',
+ `name` varchar(255) NOT NULL DEFAULT '',
`value` text NOT NULL,
- PRIMARY KEY (`name`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+ PRIMARY KEY (`name`),
+ KEY `FK_anope_ns_alias_metadata_nick` (`nick`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -245,18 +251,17 @@ CREATE TABLE IF NOT EXISTS `anope_ns_alias_metadata` (
-- Table structure for table `anope_ns_core`
--
-DROP TABLE IF EXISTS `anope_ns_core`;
CREATE TABLE IF NOT EXISTS `anope_ns_core` (
- `display` varchar(255) NOT NULL default '',
+ `display` varchar(255) NOT NULL DEFAULT '',
`pass` text NOT NULL,
`email` text NOT NULL,
`greet` text NOT NULL,
`flags` text NOT NULL,
- `language` smallint(5) unsigned NOT NULL default '0',
- `channelcount` smallint(5) unsigned NOT NULL default '0',
- `memomax` smallint(5) unsigned NOT NULL default '0',
- PRIMARY KEY (`display`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+ `language` smallint(5) unsigned NOT NULL DEFAULT '0',
+ `channelcount` smallint(5) unsigned NOT NULL DEFAULT '0',
+ `memomax` smallint(5) unsigned NOT NULL DEFAULT '0',
+ PRIMARY KEY (`display`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -264,13 +269,12 @@ CREATE TABLE IF NOT EXISTS `anope_ns_core` (
-- Table structure for table `anope_ns_core_metadata`
--
-DROP TABLE IF EXISTS `anope_ns_core_metadata`;
CREATE TABLE IF NOT EXISTS `anope_ns_core_metadata` (
- `nick` varchar(255) NOT NULL default '',
- `name` varchar(255) NOT NULL default '',
+ `nick` varchar(255) NOT NULL DEFAULT '',
+ `name` varchar(255) NOT NULL DEFAULT '',
`value` text NOT NULL,
- PRIMARY KEY (`name`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+ PRIMARY KEY (`name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -278,15 +282,14 @@ CREATE TABLE IF NOT EXISTS `anope_ns_core_metadata` (
-- Table structure for table `anope_ns_request`
--
-DROP TABLE IF EXISTS `anope_ns_request`;
CREATE TABLE IF NOT EXISTS `anope_ns_request` (
- `nick` varchar(255) NOT NULL default '',
+ `nick` varchar(255) NOT NULL DEFAULT '',
`passcode` text NOT NULL,
`password` text NOT NULL,
`email` text NOT NULL,
- `requested` int(10) unsigned NOT NULL default '0',
- PRIMARY KEY (`nick`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+ `requested` int(10) unsigned NOT NULL DEFAULT '0',
+ PRIMARY KEY (`nick`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -294,15 +297,14 @@ CREATE TABLE IF NOT EXISTS `anope_ns_request` (
-- Table structure for table `anope_os_akills`
--
-DROP TABLE IF EXISTS `anope_os_akills`;
CREATE TABLE IF NOT EXISTS `anope_os_akills` (
`user` varchar(255) NOT NULL,
`host` varchar(255) NOT NULL,
`xby` text NOT NULL,
`reason` text NOT NULL,
- `seton` int(10) unsigned NOT NULL default '0',
- `expire` int(10) unsigned NOT NULL default '0'
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+ `seton` int(10) unsigned NOT NULL DEFAULT '0',
+ `expire` int(10) unsigned NOT NULL DEFAULT '0'
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -310,15 +312,14 @@ CREATE TABLE IF NOT EXISTS `anope_os_akills` (
-- Table structure for table `anope_os_core`
--
-DROP TABLE IF EXISTS `anope_os_core`;
CREATE TABLE IF NOT EXISTS `anope_os_core` (
- `maxusercnt` int(11) NOT NULL default '0',
- `maxusertime` int(10) unsigned NOT NULL default '0',
- `akills_count` int(11) NOT NULL default '0',
- `snlines_count` int(11) NOT NULL default '0',
- `sqlines_count` int(11) NOT NULL default '0',
- `szlines_count` int(11) NOT NULL default '0'
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+ `maxusercnt` int(11) NOT NULL DEFAULT '0',
+ `maxusertime` int(10) unsigned NOT NULL DEFAULT '0',
+ `akills_count` int(11) NOT NULL DEFAULT '0',
+ `snlines_count` int(11) NOT NULL DEFAULT '0',
+ `sqlines_count` int(11) NOT NULL DEFAULT '0',
+ `szlines_count` int(11) NOT NULL DEFAULT '0'
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -326,15 +327,14 @@ CREATE TABLE IF NOT EXISTS `anope_os_core` (
-- Table structure for table `anope_os_exceptions`
--
-DROP TABLE IF EXISTS `anope_os_exceptions`;
CREATE TABLE IF NOT EXISTS `anope_os_exceptions` (
`mask` varchar(255) NOT NULL,
- `slimit` int(11) NOT NULL default '0',
+ `slimit` int(11) NOT NULL DEFAULT '0',
`who` text NOT NULL,
`reason` text NOT NULL,
- `time` int(10) unsigned NOT NULL default '0',
- `expires` int(10) unsigned NOT NULL default '0'
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+ `time` int(10) unsigned NOT NULL DEFAULT '0',
+ `expires` int(10) unsigned NOT NULL DEFAULT '0'
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -342,13 +342,93 @@ CREATE TABLE IF NOT EXISTS `anope_os_exceptions` (
-- Table structure for table `anope_os_xlines`
--
-DROP TABLE IF EXISTS `anope_os_xlines`;
CREATE TABLE IF NOT EXISTS `anope_os_xlines` (
`type` varchar(20) NOT NULL,
`mask` varchar(255) NOT NULL,
`xby` text NOT NULL,
`reason` text NOT NULL,
- `seton` int(10) unsigned NOT NULL default '0',
- `expire` int(10) unsigned NOT NULL default '0'
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+ `seton` int(10) unsigned NOT NULL DEFAULT '0',
+ `expire` int(10) unsigned NOT NULL DEFAULT '0'
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+--
+-- Constraints for dumped tables
+--
+
+--
+-- Constraints for table `anope_bs_badwords`
+--
+ALTER TABLE `anope_bs_badwords`
+ ADD CONSTRAINT `FK_anope_bs_badwords_channel` FOREIGN KEY (`channel`) REFERENCES `anope_cs_info` (`name`) ON DELETE
+CASCADE ON UPDATE CASCADE;
+
+--
+-- Constraints for table `anope_bs_info_metadata`
+--
+ALTER TABLE `anope_bs_info_metadata`
+ ADD CONSTRAINT `FK_anope_bs_info_metadata_botname` FOREIGN KEY (`botname`) REFERENCES `anope_bs_core` (`nick`) ON DELETE
+CASCADE ON UPDATE CASCADE;
+
+--
+-- Constraints for table `anope_cs_access`
+--
+ALTER TABLE `anope_cs_access`
+ ADD CONSTRAINT `FK_anope_cs_access_channel` FOREIGN KEY (`channel`) REFERENCES `anope_cs_info` (`name`) ON DELETE CASCADE
+ON UPDATE CASCADE;
+
+--
+-- Constraints for table `anope_cs_akick`
+--
+ALTER TABLE `anope_cs_akick`
+ ADD CONSTRAINT `FK_anope_cs_akick_channel` FOREIGN KEY (`channel`) REFERENCES `anope_cs_info` (`name`) ON DELETE CASCADE
+ON UPDATE CASCADE;
+
+--
+-- Constraints for table `anope_cs_info_metadata`
+--
+ALTER TABLE `anope_cs_info_metadata`
+ ADD CONSTRAINT `FK_anope_cs_info_metadata_channel` FOREIGN KEY (`channel`) REFERENCES `anope_cs_info` (`name`) ON DELETE
+CASCADE ON UPDATE CASCADE;
+
+--
+-- Constraints for table `anope_cs_levels`
+--
+ALTER TABLE `anope_cs_levels`
+ ADD CONSTRAINT `FK_anope_cs_levels_channel` FOREIGN KEY (`channel`) REFERENCES `anope_cs_info` (`name`) ON DELETE CASCADE
+ON UPDATE CASCADE;
+
+--
+-- Constraints for table `anope_cs_ttb`
+--
+ALTER TABLE `anope_cs_ttb`
+ ADD CONSTRAINT `FK_anope_cs_ttb_channel` FOREIGN KEY (`channel`) REFERENCES `anope_cs_info` (`name`) ON DELETE CASCADE ON
+UPDATE CASCADE;
+
+--
+-- Constraints for table `anope_ms_info`
+--
+ALTER TABLE `anope_ms_info`
+ ADD CONSTRAINT `FK_anope_ms_info_receiver` FOREIGN KEY (`receiver`) REFERENCES `anope_ns_alias` (`nick`) ON DELETE CASCADE
+ON UPDATE CASCADE;
+
+--
+-- Constraints for table `anope_ns_access`
+--
+ALTER TABLE `anope_ns_access`
+ ADD CONSTRAINT `FK_anope_ns_access_display` FOREIGN KEY (`display`) REFERENCES `anope_ns_core` (`display`) ON DELETE
+CASCADE ON UPDATE CASCADE;
+
+--
+-- Constraints for table `anope_ns_alias`
+--
+ALTER TABLE `anope_ns_alias`
+ ADD CONSTRAINT `FK_anope_ns_alias_display` FOREIGN KEY (`display`) REFERENCES `anope_ns_core` (`display`) ON DELETE
+CASCADE ON UPDATE CASCADE;
+
+--
+-- Constraints for table `anope_ns_alias_metadata`
+--
+ALTER TABLE `anope_ns_alias_metadata`
+ ADD CONSTRAINT `FK_anope_ns_alias_metadata_nick` FOREIGN KEY (`nick`) REFERENCES `anope_ns_alias` (`nick`) ON DELETE
+CASCADE ON UPDATE CASCADE;