A semantic search engine for source code https://bitshift.benkurtovic.com/
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 
 
 

69 行
3.0 KiB

  1. CREATE DATABASE `bitshift` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
  2. USE `bitshift`;
  3. CREATE TABLE `languages` (
  4. `language_id` SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE,
  5. `language_name` VARCHAR(64) NOT NULL,
  6. PRIMARY KEY (`language_id`)
  7. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  8. CREATE TABLE `origins` (
  9. `origin_id` TINYINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE,
  10. `origin_name` VARCHAR(64) NOT NULL,
  11. `origin_url` VARCHAR(512) NOT NULL,
  12. `origin_url_base` VARCHAR(512) NOT NULL,
  13. `origin_image` TINYBLOB DEFAULT NULL, -- TODO: verify size (<64kB)
  14. PRIMARY KEY (`origin_id`)
  15. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  16. CREATE TABLE `codelets` (
  17. `codelet_id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE,
  18. `codelet_name` VARCHAR(512) NOT NULL,
  19. `codelet_code_id` BIGINT UNSIGNED NOT NULL,
  20. `codelet_lang` SMALLINT UNSIGNED DEFAULT NULL, -- TODO: needs index
  21. `codelet_origin` TINYINT UNSIGNED NOT NULL,
  22. `codelet_url` VARCHAR(512) NOT NULL,
  23. `codelet_date_created` DATETIME DEFAULT NULL, -- TODO: needs index
  24. `codelet_date_modified` DATETIME DEFAULT NULL, -- TODO: needs index
  25. PRIMARY KEY (`codelet_id`)
  26. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  27. CREATE TABLE `code` (
  28. `code_id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE,
  29. `code_hash` BIGINT NOT NULL, -- TODO: needs index
  30. `code_code` MEDIUMTEXT NOT NULL, -- TODO: verify size (16mB?)
  31. PRIMARY KEY (`code_id`)
  32. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  33. CREATE TABLE `authors` (
  34. `author_id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE,
  35. `author_codelet` BIGINT UNSIGNED NOT NULL, -- TODO: foreign index?
  36. `author_name` VARCHAR(128) NOT NULL, -- TODO: needs index
  37. `author_url` VARCHAR(512) DEFAULT NULL,
  38. PRIMARY KEY (`author_id`)
  39. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  40. CREATE TABLE `symbols` (
  41. `symbol_id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE,
  42. `symbol_codelet` BIGINT UNSIGNED NOT NULL, -- TODO: foreign index?
  43. `symbol_type` TINYINT UNSIGNED NOT NULL, -- TODO: multi-column index?
  44. `symbol_name` VARCHAR(512) NOT NULL, -- TODO: needs index
  45. `symbol_row` INT UNSIGNED NOT NULL,
  46. `symbol_col` INT UNSIGNED NOT NULL,
  47. PRIMARY KEY (`symbol_id`)
  48. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  49. CREATE TABLE `query_cache` (
  50. `qcache_id` INT NOT NULL UNIQUE,
  51. `qcache_query` VARCHAR(512) NOT NULL,
  52. `qcache_results` BLOB NOT NULL, -- TODO: verify; perhaps use some kind of array
  53. `qcache_page` TINYINT UNSIGNED NOT NULL,
  54. `qcache_count_mnt` TINYINT UNSIGNED NOT NULL,
  55. `qcache_count_exp` TINYINT UNSIGNED NOT NULL,
  56. `qcache_created` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, -- TODO: verify
  57. `qcache_last_used` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, -- TODO: verify
  58. PRIMARY KEY (`cache_id`)
  59. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  60. -- TODO: full-text search index table