diff options
author | Adam <Adam@anope.org> | 2017-02-07 17:20:07 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2017-02-07 17:20:07 -0500 |
commit | 09dca29c8898916772c2a2a6b86b625c812007ed (patch) | |
tree | 1b28f4751feec3ea2b46fa0afb061da7926f3a47 /docs | |
parent | 8b694bc392c36551e428b84454efb81cdbc8bcd3 (diff) |
Normalize databases by not allowing generic Object references
Remove redis database support
Diffstat (limited to 'docs')
-rw-r--r-- | docs/SQLite.md | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/docs/SQLite.md b/docs/SQLite.md index be25bbb27..30e0d7b12 100644 --- a/docs/SQLite.md +++ b/docs/SQLite.md @@ -6,21 +6,21 @@ It does this by using SQLites support for having indexes on expressions https:// For example the account table could look like: ``` -CREATE TABLE `anope_db_account` ( +CREATE TABLE `anope_account` ( + `id` INTEGER PRIMARY KEY AUTOINCREMENT, `display`, `pass`, `email`, - `language`, - `id` NOT NULL PRIMARY KEY, - FOREIGN KEY (id) REFERENCES anope_db_objects(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED + `language` ); -CREATE INDEX idx_display ON `anope_db_account` (anope_canonicalize(display)); + +CREATE INDEX idx_display ON `anope_account` (anope_canonicalize(display)); ``` So, to do a SELECT which utilizes the indicies, Anope does something like: ``` -SELECT id FROM `anope_db_account` WHERE anope_canonicalize(display) = anope_canonicalize('Adam'); +SELECT id FROM `anope_account` WHERE anope_canonicalize(display) = anope_canonicalize('Adam'); ``` If you are using your own SQLite instance, like the sqlite command line interface, the anope_canonicalize function @@ -31,13 +31,13 @@ or libanope_sqlite_rfc1459.so into SQLite, depending on your casemap configurati sqlite> .load lib/libanope_sqlite_ascii.so ``` -## Example of adding a new operator via SQLite +## Example of registering a new user via SQLite ``` BEGIN TRANSACTION; --- Allocate new ID and insert into objects table -INSERT INTO anope_db_objects (id, type) SELECT MAX(id + 1), 'oper' FROM anope_db_objects; --- Insert new operator using previously allocated id -INSERT INTO anope_db_oper (name, type, require_oper, id) VALUES ('Adam', 'Services Root', 1, last_insert_rowid()); +-- Insert new account +INSERT INTO anope_account (display, email, private, autoop, killprotect) VALUES ('Adam', 'adam@anope.org', 1, 1, 1); +-- Insert nickname, linking it to the account +INSERT INTO anope_nick (nick, account) VALUES ('Adam', last_insert_rowid()); COMMIT; ``` |