summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2011-09-25 04:19:15 -0400
committerAdam <Adam@anope.org>2011-09-25 04:19:15 -0400
commit1f2399de364c09adcce4193895cd362d80ffdfc5 (patch)
tree5f40fc531f22c174b6e10bb7bc12842a4a21d30b /data
parent43201ead9575a74e350710bc191f4ac67366aca7 (diff)
Added a new database format and sqlite support. Also moved db-convert to a module.
Diffstat (limited to 'data')
-rw-r--r--data/CMakeLists.txt2
-rw-r--r--data/example.conf77
-rw-r--r--data/modules.example.conf20
-rw-r--r--data/tables.sql426
4 files changed, 79 insertions, 446 deletions
diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt
index a9f27a5f8..94aa3d8ca 100644
--- a/data/CMakeLists.txt
+++ b/data/CMakeLists.txt
@@ -1,6 +1,6 @@
# Only install example.chk and example.conf from this directory
# NOTE: I would've had this just find all files in the directory, but that would include files not needed (like this file)
-set(DATA example.chk tables.sql botserv.example.conf example.conf hostserv.example.conf modules.example.conf operserv.example.conf chanserv.example.conf global.example.conf memoserv.example.conf nickserv.example.conf)
+set(DATA example.chk botserv.example.conf example.conf hostserv.example.conf modules.example.conf operserv.example.conf chanserv.example.conf global.example.conf memoserv.example.conf nickserv.example.conf)
install(FILES ${DATA}
DESTINATION data
)
diff --git a/data/example.conf b/data/example.conf
index b9a37a275..b29e56280 100644
--- a/data/example.conf
+++ b/data/example.conf
@@ -1032,11 +1032,29 @@ dns
*/
/*
- * db_plain
+ * [DEPRECATED] db_old
*
- * This is the default flatfile database format.
+ * This is the old binary database format from late Anope 1.7.x, Anope 1.8.x, and
+ * early Anope 1.9.x. This module only loads these databases, and will NOT save them.
+ * You should only use this to upgrade old databases to a newer database format by loading
+ * other database modules in addition to this one, which will be used when saving databases.
+ */
+#module { name = "db_old" }
+db_old
+{
+ /*
+ * This is the encryption type used by the databases. This must be set correctly or
+ * your passwords will not work. Valid options are: md5, oldmd5, sha1, and plain.
+ */
+ #hash = "md5"
+}
+
+/*
+ * [DEPRECATED] db_plain
+ *
+ * This is the flatfile database format from Anope-1.9.2 to Anope-1.9.5.
*/
-module { name = "db_plain" }
+#module { name = "db_plain" }
db_plain
{
/*
@@ -1046,25 +1064,52 @@ db_plain
}
/*
- * db_mysql and db_mysql_live
+ * db_flatfile
+ *
+ * This is the default flatfile database format.
+ */
+module { name = "db_flatfile" }
+db_flatfile
+{
+ /*
+ * The database name db_flatfile should use
+ */
+ database = "anope.db"
+}
+
+/*
+ * db_sql
+ *
+ * This module allows saving and loading databases using one of the SQL engines.
+ */
+#module { name = "db_sql" }
+db_sql
+{
+ /*
+ * The SQL service db_sql should use, these are configured in modules.conf.
+ * For MySQL, this should probably be mysql/main.
+ */
+ engine = "sqlite/main"
+}
+
+/*
+ * db_sql_live_read, db_sql_live_write
*
- * Enables (live) MySQL support.
+ * Enables (live) SQL support.
*
- * The db_mysql_live module is an extension to db_mysql, and should only be used if
- * db_mysql is being used. This module pulls data in real time from SQL as it is
- * requested by the core as a result of someone executing commands.
+ * The db_sql_live modules are an extension to db_sql, and should only be used if
+ * db_sql is being used.
*
- * This effectively allows you to edit your database and have it be immediately
- * reflected back in Anope.
+ * The db_sql_live_read module pulls data in real time from
+ * SQL as it is needed by the core.
+ * At this time this three main tables: ChannelInfo, NickAlias, and NickCore.
*
- * At this time db_mysql_live only supports pulling data in real time from the three
- * main tables: anope_cs_info, anope_ns_alias, and anope_ns_core.
+ * The db_sql_live_write module writes data to SQL in real time as it is modified by
+ * the core.
*
- * db_mysql provides the command operserv/sqlsync, which is used for importing other database
- * methods into MySQL.
*/
-#module { name = "db_mysql" }
-#module { name = "db_mysql_live" }
+#module { name = "db_sql_live_read" }
+#module { name = "db_sql_live_write" }
/*
* [REQUIRED] Encryption modules.
diff --git a/data/modules.example.conf b/data/modules.example.conf
index 74c8bff5d..e03761fb2 100644
--- a/data/modules.example.conf
+++ b/data/modules.example.conf
@@ -197,13 +197,13 @@ m_ldap_oper
/*
* m_mysql
*
- * This module allows other modules (db_mysql/db_mysql_live) to use MySQL.
- * Be sure you have imported the table schema with mydbgen before
- * trying to use MySQL
+ * This module allows other modules to use MySQL.
*/
#module { name = "m_mysql" }
mysql
{
+ /* The name of this service */
+ name = "mysql/main"
database = "anope"
server = "127.0.0.1"
username = "anope"
@@ -297,6 +297,20 @@ proxyscan
}
/*
+ * m_sqlite
+ *
+ * This module allows other modules to use SQLite.
+ */
+#module { name = "m_sqlite" }
+sqlite
+{
+ /* The name of this service */
+ name = "sqlite/main"
+ /* The database name, it will be created if it does not exist. */
+ database = "anope.db"
+}
+
+/*
* m_ssl
*
* This module uses SSL to connect to the uplink server(s)
diff --git a/data/tables.sql b/data/tables.sql
deleted file mode 100644
index ec99b7479..000000000
--- a/data/tables.sql
+++ /dev/null
@@ -1,426 +0,0 @@
--- phpMyAdmin SQL Dump
--- version 3.3.5
--- http://www.phpmyadmin.net
---
--- Host: localhost
--- Generation Time: Aug 07, 2011 at 03:53 PM
--- Server version: 5.1.50
--- PHP Version: 5.3.6-pl0-gentoo
-
-SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
-
---
--- Database: `anope`
---
-
--- --------------------------------------------------------
-
---
--- Table structure for table `anope_bs_badwords`
---
-
-CREATE TABLE IF NOT EXISTS `anope_bs_badwords` (
- `channel` varchar(255) NOT NULL DEFAULT '',
- `word` varchar(255) NOT NULL,
- `type` varchar(50) NOT NULL,
- UNIQUE KEY `channel` (`channel`,`word`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
--- --------------------------------------------------------
-
---
--- Table structure for table `anope_bs_core`
---
-
-CREATE TABLE IF NOT EXISTS `anope_bs_core` (
- `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=InnoDB DEFAULT CHARSET=utf8;
-
--- --------------------------------------------------------
-
---
--- Table structure for table `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,
- KEY `FK_anope_bs_info_metadata_botname` (`botname`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
--- --------------------------------------------------------
-
---
--- Table structure for table `anope_cs_access`
---
-
-CREATE TABLE IF NOT EXISTS `anope_cs_access` (
- `provider` varchar(255) NOT NULL DEFAULT '',
- `data` varchar(255) NOT NULL DEFAULT '',
- `mask` 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 '',
- `created` int(11) unsigned NOT NULL DEFAULT '0',
- UNIQUE KEY `channel` (`channel`,`mask`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
--- --------------------------------------------------------
-
---
--- Table structure for table `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 '',
- `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',
- UNIQUE KEY `channel` (`channel`,`mask`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
--- --------------------------------------------------------
-
---
--- Table structure for table `anope_cs_info`
---
-
-CREATE TABLE IF NOT EXISTS `anope_cs_info` (
- `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',
- `last_topic` text NOT NULL,
- `last_topic_setter` text NOT NULL,
- `last_topic_time` int(10) unsigned NOT NULL DEFAULT '0',
- `flags` text NOT NULL,
- `bantype` smallint(6) NOT NULL DEFAULT '0',
- `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=InnoDB DEFAULT CHARSET=utf8;
-
--- --------------------------------------------------------
-
---
--- Table structure for table `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,
- KEY `FK_anope_cs_info_metadata_channel` (`channel`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
--- --------------------------------------------------------
-
---
--- Table structure for table `anope_cs_levels`
---
-
-CREATE TABLE IF NOT EXISTS `anope_cs_levels` (
- `channel` varchar(255) NOT NULL DEFAULT '',
- `name` varchar(255) NOT NULL DEFAULT '',
- `level` int(11) NOT NULL DEFAULT '0',
- UNIQUE KEY `channel` (`channel`,`name`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
--- --------------------------------------------------------
-
---
--- Table structure for table `anope_cs_mlock`
---
-
-CREATE TABLE IF NOT EXISTS `anope_cs_mlock` (
- `channel` varchar(255) NOT NULL,
- `mode` varchar(127) NOT NULL,
- `status` int(11) NOT NULL,
- `setter` varchar(255) NOT NULL,
- `created` int(11) NOT NULL,
- `param` varchar(255) NOT NULL,
- UNIQUE KEY `entry` (`channel`,`mode`,`status`,`setter`,`param`),
- KEY `FK_anope_cs_mlock` (`channel`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
--- --------------------------------------------------------
-
---
--- Table structure for table `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',
- UNIQUE KEY `channel` (`channel`,`ttb_id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
--- --------------------------------------------------------
-
---
--- Table structure for table `anope_extra`
---
-
-CREATE TABLE IF NOT EXISTS `anope_extra` (
- `data` text NOT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
--- --------------------------------------------------------
-
---
--- Table structure for table `anope_hs_core`
---
-
-CREATE TABLE IF NOT EXISTS `anope_hs_core` (
- `nick` varchar(255) NOT NULL,
- `vident` varchar(64) NOT NULL,
- `vhost` varchar(255) NOT NULL,
- `creator` varchar(255) NOT NULL,
- `time` int(11) NOT NULL,
- KEY `FK_anope_hs_core_nick` (`nick`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
--- --------------------------------------------------------
-
---
--- Table structure for table `anope_info`
---
-
-CREATE TABLE IF NOT EXISTS `anope_info` (
- `version` int(11) DEFAULT NULL,
- `date` datetime DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
--- --------------------------------------------------------
-
---
--- Table structure for table `anope_ms_info`
---
-
-CREATE TABLE IF NOT EXISTS `anope_ms_info` (
- `receiver` varchar(255) NOT NULL,
- `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',
- KEY `FK_anope_ms_info_receiver` (`receiver`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
--- --------------------------------------------------------
-
---
--- Table structure for table `anope_ns_access`
---
-
-CREATE TABLE IF NOT EXISTS `anope_ns_access` (
- `display` varchar(255) NOT NULL DEFAULT '',
- `access` varchar(160) NOT NULL,
- KEY `FK_anope_ns_access_display` (`display`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
--- --------------------------------------------------------
-
---
--- Table structure for table `anope_ns_alias`
---
-
-CREATE TABLE IF NOT EXISTS `anope_ns_alias` (
- `nick` varchar(255) NOT NULL DEFAULT '',
- `last_quit` text NOT NULL,
- `last_realname` text NOT NULL,
- `last_usermask` text NOT NULL,
- `last_realhost` text NOT NULL,
- `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`),
- KEY `FK_anope_ns_alias_display` (`display`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
--- --------------------------------------------------------
-
---
--- Table structure for table `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 '',
- `value` text NOT NULL,
- KEY `FK_anope_ns_alias_metadata_nick` (`nick`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
--- --------------------------------------------------------
-
---
--- Table structure for table `anope_ns_core`
---
-
-CREATE TABLE IF NOT EXISTS `anope_ns_core` (
- `display` varchar(255) NOT NULL DEFAULT '',
- `pass` text NOT NULL,
- `email` text NOT NULL,
- `greet` text NOT NULL,
- `flags` text NOT NULL,
- `language` varchar(5) NOT NULL DEFAULT '',
- `memomax` smallint(5) unsigned NOT NULL DEFAULT '0',
- PRIMARY KEY (`display`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
--- --------------------------------------------------------
-
---
--- Table structure for table `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 '',
- `value` text NOT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
--- --------------------------------------------------------
-
---
--- Table structure for table `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'
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
--- --------------------------------------------------------
-
---
--- Table structure for table `anope_os_exceptions`
---
-
-CREATE TABLE IF NOT EXISTS `anope_os_exceptions` (
- `mask` varchar(255) NOT NULL,
- `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=InnoDB DEFAULT CHARSET=utf8;
-
--- --------------------------------------------------------
-
---
--- Table structure for table `anope_os_xlines`
---
-
-CREATE TABLE IF NOT EXISTS `anope_os_xlines` (
- `type` varchar(1) 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=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_mlock`
---
-ALTER TABLE `anope_cs_mlock`
- ADD CONSTRAINT `FK_anope_cs_mlock_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_hs_core`
---
-ALTER TABLE `anope_hs_core`
- ADD CONSTRAINT `FK_anope_hs_core_nick` FOREIGN KEY (`nick`) REFERENCES `anope_ns_alias` (`nick`) 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;
-