function quotes_install in Quotes 5
Same name and namespace in other branches
- 6 quotes.install \quotes_install()
- 7 quotes.install \quotes_install()
Implementation of hook_install().
File
- ./
quotes.install, line 18 - Handles installation and updates for the quotes module.
Code
function quotes_install() {
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
db_query('CREATE TABLE {quotes} (
nid INTEGER UNSIGNED NOT NULL,
vid INTEGER UNSIGNED NOT NULL PRIMARY KEY,
aid INTEGER UNSIGNED NOT NULL,
citation TEXT,
promote INTEGER UNSIGNED NOT NULL DEFAULT 0
) /*!40100 DEFAULT CHARACTER SET utf8 */');
db_query('CREATE INDEX {quotes}_nid ON {quotes} (nid)');
db_query('CREATE INDEX {quotes}_promote ON {quotes} (promote)');
db_query('CREATE INDEX {quotes}_aid ON {quotes} (aid)');
db_query('CREATE TABLE {quotes_blocks} (
bid INTEGER NOT NULL PRIMARY KEY,
block_type INTEGER NOT NULL,
cron_interval INTEGER NOT NULL,
cron_step INTEGER NOT NULL,
cron_last INTEGER NOT NULL,
vid INTEGER NOT NULL,
count INTEGER NOT NULL DEFAULT 1,
show_titles INTEGER NOT NULL DEFAULT 0,
show_citation INTEGER NOT NULL DEFAULT 0,
max_length INTEGER NOT NULL DEFAULT 0,
view_weight INTEGER NOT NULL DEFAULT 1,
rand_freq INTEGER NOT NULL DEFAULT 100,
name VARCHAR(255) NOT NULL UNIQUE,
nid_filter TEXT NOT NULL,
aid_filter TEXT NOT NULL,
rid_filter TEXT NOT NULL,
uid_filter TEXT NOT NULL,
tid_filter TEXT NOT NULL,
view_text VARCHAR(64),
more_text VARCHAR(64)
) /*!40100 DEFAULT CHARACTER SET utf8 */');
db_query('CREATE TABLE {quotes_authors} (
aid INT(10) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
name TEXT NOT NULL,
bio TEXT NULL,
INDEX (name (255))
) /*!40100 DEFAULT CHARACTER SET utf8 */');
break;
case 'pgsql':
db_query('CREATE TABLE {quotes} (
nid INTEGER NOT NULL,
vid INTEGER NOT NULL,
aid INTEGER NOT NULL,
citation TEXT,
promote INTEGER NOT NULL,
PRIMARY KEY(vid)
)');
db_query('CREATE INDEX {quotes}_nid_idx ON {quotes} (nid)');
db_query('CREATE INDEX {quotes}_promote_idx ON {quotes} (promote)');
db_query('CREATE TABLE {quotes_blocks} (
bid INTEGER NOT NULL,
block_type INTEGER NOT NULL,
vid INTEGER NOT NULL,
cron_interval INTEGER NOT NULL,
cron_step INTEGER NOT NULL,
cron_last INTEGER NOT NULL,
count INTEGER NOT NULL DEFAULT 1,
show_titles INTEGER NOT NULL DEFAULT 0,
show_citation INTEGER NOT NULL DEFAULT 0,
max_length INTEGER NOT NULL DEFAULT 0,
view_weight INTEGER NOT NULL DEFAULT 1,
rand_freq INTEGER NOT NULL DEFAULT 100,
name VARCHAR(255) NOT NULL,
nid_filter TEXT NOT NULL,
aid_filter TEXT NOT NULL,
rid_filter TEXT NOT NULL,
uid_filter TEXT NOT NULL,
tid_filter TEXT NOT NULL,
view_text VARCHAR(64),
more_text VARCHAR(64),
PRIMARY KEY(bid),
UNIQUE(name))');
db_query('CREATE TABLE {quotes_authors} (
aid SERIAL,
name TEXT NOT NULL,
bio TEXT NULL,
PRIMARY KEY(aid),
UNIQUE(name))');
db_query('CREATE INDEX {quotes_authors}_name_idx ON {quotes_authors} (name)');
}
}