Browse Source

FULLTEXT KEYs where appropriate.

tags/v1.0^2
Ben Kurtovic 10 years ago
parent
commit
fb4e0d5916
1 changed files with 7 additions and 4 deletions
  1. +7
    -4
      schema.sql

+ 7
- 4
schema.sql View File

@@ -13,14 +13,15 @@ CREATE TABLE `origins` (
CREATE TABLE `code` ( CREATE TABLE `code` (
`code_id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, `code_id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
`code_hash` BIGINT NOT NULL, `code_hash` BIGINT NOT NULL,
`code_code` MEDIUMTEXT NOT NULL, -- TODO: full-text search index
`code_code` MEDIUMTEXT NOT NULL,
PRIMARY KEY (`code_id`), PRIMARY KEY (`code_id`),
KEY (`code_hash`)
KEY (`code_hash`),
FULLTEXT KEY (`codelet_code`)
) ENGINE=InnoDB; ) ENGINE=InnoDB;


CREATE TABLE `codelets` ( CREATE TABLE `codelets` (
`codelet_id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, `codelet_id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
`codelet_name` VARCHAR(300) NOT NULL, -- TODO: full-text search index
`codelet_name` VARCHAR(300) NOT NULL,
`codelet_code_id` BIGINT UNSIGNED NOT NULL, `codelet_code_id` BIGINT UNSIGNED NOT NULL,
`codelet_lang` SMALLINT UNSIGNED DEFAULT NULL, `codelet_lang` SMALLINT UNSIGNED DEFAULT NULL,
`codelet_origin` TINYINT UNSIGNED NOT NULL, `codelet_origin` TINYINT UNSIGNED NOT NULL,
@@ -29,6 +30,7 @@ CREATE TABLE `codelets` (
`codelet_date_created` DATETIME DEFAULT NULL, `codelet_date_created` DATETIME DEFAULT NULL,
`codelet_date_modified` DATETIME DEFAULT NULL, `codelet_date_modified` DATETIME DEFAULT NULL,
PRIMARY KEY (`codelet_id`), PRIMARY KEY (`codelet_id`),
FULLTEXT KEY (`codelet_name`),
KEY (`codelet_rank`), KEY (`codelet_rank`),
KEY (`codelet_date_created`), KEY (`codelet_date_created`),
KEY (`codelet_date_modified`), KEY (`codelet_date_modified`),
@@ -43,9 +45,10 @@ CREATE TABLE `codelets` (
CREATE TABLE `authors` ( CREATE TABLE `authors` (
`author_id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, `author_id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
`author_codelet` BIGINT UNSIGNED NOT NULL, `author_codelet` BIGINT UNSIGNED NOT NULL,
`author_name` VARCHAR(128) NOT NULL, -- TODO: full-text search index
`author_name` VARCHAR(128) NOT NULL,
`author_url` VARCHAR(512) DEFAULT NULL, `author_url` VARCHAR(512) DEFAULT NULL,
PRIMARY KEY (`author_id`), PRIMARY KEY (`author_id`),
FULLTEXT KEY (`author_name`),
FOREIGN KEY (`author_codelet`) FOREIGN KEY (`author_codelet`)
REFERENCES `codelet` (`codelet_id`) REFERENCES `codelet` (`codelet_id`)
ON DELETE CASCADE ON UPDATE CASCADE ON DELETE CASCADE ON UPDATE CASCADE


Loading…
Cancel
Save