db-create.xml 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <!-- ***** BEGIN LICENSE BLOCK *****
  3. - This file is part of DotClear.
  4. - Copyright (c) 2004 Olivier Meunier and contributors. All rights
  5. - reserved.
  6. -
  7. - DotClear is free software; you can redistribute it and/or modify
  8. - it under the terms of the GNU General Public License as published by
  9. - the Free Software Foundation; either version 2 of the License, or
  10. - (at your option) any later version.
  11. -
  12. - DotClear is distributed in the hope that it will be useful,
  13. - but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. - GNU General Public License for more details.
  16. -
  17. - You should have received a copy of the GNU General Public License
  18. - along with DotClear; if not, write to the Free Software
  19. - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. -
  21. - ***** END LICENSE BLOCK ***** -->
  22. <database>
  23. <!--
  24. Suppression des tables, UNIQUEMENT POUR TEST. NE PAS DECOMMENTER.
  25. <action id="droptables" label="Drop tables">
  26. DROP TABLE IF EXISTS `{{PREFIX}}categorie`, `{{PREFIX}}comment`,
  27. `{{PREFIX}}log`, `{{PREFIX}}ping`, `{{PREFIX}}post`, `{{PREFIX}}user`
  28. </action>
  29. -->
  30. <!-- USER -->
  31. <action id="user" label="Create table %s" string="{{PREFIX}}user">
  32. <test eq="neq" value="{{PREFIX}}user" label="Table %s exists"
  33. string="{{PREFIX}}user">SHOW TABLES LIKE '{{PREFIX}}user'</test>
  34. CREATE TABLE `{{PREFIX}}user` (
  35. `user_id` varchar(32) binary NOT NULL default '',
  36. `user_level` int(11) NOT NULL default '0',
  37. `user_pwd` varchar(32) binary NOT NULL default '',
  38. `user_nom` varchar(255) binary default NULL,
  39. `user_prenom` varchar(255) binary default NULL,
  40. `user_pseudo` varchar(255) binary default NULL,
  41. `user_email` varchar(255) default NULL,
  42. `user_post_format` varchar(5) NOT NULL default 'wiki',
  43. `user_edit_size` int(11) NOT NULL default '10',
  44. `user_pref_cat` int(11) default NULL,
  45. `user_lang` char(3) default NULL,
  46. `user_delta` int(1) NOT NULL default '0',
  47. `user_post_pub` int(1) NOT NULL default '0',
  48. PRIMARY KEY (`user_id`)
  49. ) TYPE=MyISAM
  50. </action>
  51. <!-- CATEGORIE -->
  52. <action id="categorie" label="Create table %s" string="{{PREFIX}}categorie">
  53. <test eq="neq" value="{{PREFIX}}categorie" label="Table %s exists"
  54. string="{{PREFIX}}categorie">SHOW TABLES LIKE '{{PREFIX}}categorie'</test>
  55. CREATE TABLE `{{PREFIX}}categorie` (
  56. `cat_id` int(11) NOT NULL auto_increment,
  57. `cat_libelle` varchar(255) NOT NULL default '',
  58. `cat_desc` longtext,
  59. `cat_libelle_url` varchar(255) NOT NULL default '',
  60. `cat_ord` int(11) default NULL,
  61. PRIMARY KEY (`cat_id`),
  62. UNIQUE KEY `cat_libelle_url` (`cat_libelle_url`),
  63. UNIQUE KEY `cat_libelle` (`cat_libelle`)
  64. ) TYPE=MyISAM
  65. </action>
  66. <!-- POST -->
  67. <action id="post" label="Create table %s" string="{{PREFIX}}post">
  68. <test eq="neq" value="{{PREFIX}}post" label="Table %s exists"
  69. string="{{PREFIX}}post">SHOW TABLES LIKE '{{PREFIX}}post'</test>
  70. CREATE TABLE `{{PREFIX}}post` (
  71. `post_id` int(11) NOT NULL auto_increment,
  72. `user_id` varchar(32) binary NOT NULL default '',
  73. `cat_id` int(11) default NULL,
  74. `post_dt` datetime default NULL,
  75. `post_creadt` datetime default NULL,
  76. `post_upddt` datetime default NULL,
  77. `post_titre` varchar(255) default NULL,
  78. `post_titre_url` varchar(255) default NULL,
  79. `post_chapo` longtext,
  80. `post_chapo_wiki` longtext,
  81. `post_content` longtext,
  82. `post_content_wiki` longtext,
  83. `post_notes` longtext,
  84. `post_pub` int(1) NOT NULL default '0',
  85. `post_selected` int(1) NOT NULL default '0',
  86. `post_open_comment` int(1) NOT NULL default '0',
  87. `post_open_tb` int(1) NOT NULL default '0',
  88. `nb_comment` int(11) NOT NULL default '0',
  89. `nb_trackback` int(11) NOT NULL default '0',
  90. `post_lang` varchar(5) default NULL,
  91. PRIMARY KEY (`post_id`)
  92. ) TYPE=MyISAM
  93. </action>
  94. <!-- COMMENT -->
  95. <action id="comment" label="Create table %s" string="{{PREFIX}}comment">
  96. <test eq="neq" value="{{PREFIX}}comment" label="Table %s exists"
  97. string="{{PREFIX}}comment">SHOW TABLES LIKE '{{PREFIX}}comment'</test>
  98. CREATE TABLE `{{PREFIX}}comment` (
  99. `comment_id` int(11) NOT NULL auto_increment,
  100. `post_id` int(11) NOT NULL default '0',
  101. `comment_dt` datetime default NULL,
  102. `comment_upddt` datetime default NULL,
  103. `comment_auteur` varchar(255) default NULL,
  104. `comment_email` varchar(255) default NULL,
  105. `comment_site` varchar(255) default NULL,
  106. `comment_content` longtext,
  107. `comment_ip` varchar(15) default NULL,
  108. `comment_pub` int(1) default '0',
  109. `comment_trackback` int(1) NOT NULL default '0',
  110. PRIMARY KEY (`comment_id`)
  111. ) TYPE=MyISAM
  112. </action>
  113. <!-- PING -->
  114. <action id="ping" label="Create table %s" string="{{PREFIX}}ping">
  115. <test eq="neq" value="{{PREFIX}}ping" label="Table %s exists"
  116. string="{{PREFIX}}ping">SHOW TABLES LIKE '{{PREFIX}}ping'</test>
  117. CREATE TABLE `{{PREFIX}}ping` (
  118. `ping_id` int(11) NOT NULL auto_increment,
  119. `post_id` int(11) NOT NULL default '0',
  120. `ping_url` varchar(255) NOT NULL default '0',
  121. `ping_dt` datetime default NULL,
  122. PRIMARY KEY (`ping_id`)
  123. ) TYPE=MyISAM
  124. </action>
  125. <!-- LOG -->
  126. <action id="log" label="Create table %s" string="{{PREFIX}}log">
  127. <test eq="neq" value="{{PREFIX}}log" label="Table %s exists"
  128. string="{{PREFIX}}log">SHOW TABLES LIKE '{{PREFIX}}log'</test>
  129. CREATE TABLE `{{PREFIX}}log` (
  130. `user_id` varchar(32) binary NOT NULL default '',
  131. `table` varchar(255) NOT NULL default '',
  132. `key` varchar(255) NOT NULL default '',
  133. `date` datetime NOT NULL default '0000-00-00 00:00:00',
  134. `ip` varchar(15) default NULL,
  135. `log` varchar(255) NOT NULL default ''
  136. ) TYPE=MyISAM
  137. </action>
  138. <!-- LINK -->
  139. <action id="link" label="Create table %s" string="{{PREFIX}}link">
  140. <test eq="neq" value="{{PREFIX}}link" label="Table %s exists"
  141. string="{{PREFIX}}link">SHOW TABLES LIKE '{{PREFIX}}link'</test>
  142. CREATE TABLE `{{PREFIX}}link` (
  143. `link_id` int(11) NOT NULL auto_increment,
  144. `href` varchar(255) NOT NULL default '',
  145. `label` varchar(255) NOT NULL default '',
  146. `title` varchar(255) NOT NULL default '',
  147. `lang` char(2) NOT NULL default '',
  148. `rel` varchar(255) default NULL,
  149. `position` int(11) NOT NULL default '0',
  150. PRIMARY KEY (`link_id`)
  151. ) TYPE=MyISAM
  152. </action>
  153. <!-- SESSION -->
  154. <action id="session" label="Create table %s" string="{{PREFIX}}session">
  155. <test eq="neq" value="{{PREFIX}}session" label="Table %s exists"
  156. string="{{PREFIX}}session">SHOW TABLES LIKE '{{PREFIX}}session'</test>
  157. CREATE TABLE `{{PREFIX}}session` (
  158. `ses_id` varchar(32) NOT NULL default '',
  159. `ses_time` int(11) NOT NULL default '0',
  160. `ses_start` int(11) NOT NULL default '0',
  161. `ses_value` text NOT NULL,
  162. PRIMARY KEY (`ses_id`)
  163. ) TYPE=MyISAM
  164. </action>
  165. <!-- FULLTEXT KEYS -->
  166. <action id="fulltitle" label="Add fulltext key %s" string="full_post_titre">
  167. <test eq="eq" value="1" label="MySQL version too old" type="wrn">
  168. SELECT REPLACE(VERSION(),'-log','') >= '3.23.23'
  169. </test>
  170. ALTER TABLE `{{PREFIX}}post` ADD FULLTEXT `full_post_titre` (`post_titre`)
  171. </action>
  172. <action id="fullcontent" label="Add fulltext key %s" string="full_post_content">
  173. <test eq="eq" value="1" label="MySQL version too old" type="wrn">
  174. SELECT REPLACE(VERSION(),'-log','') >= '3.23.23'
  175. </test>
  176. ALTER TABLE `{{PREFIX}}post` ADD FULLTEXT `full_post_content` (`post_content`)
  177. </action>
  178. <action id="fullchapo" label="Add fulltext key %s" string="full_post_chapo">
  179. <test eq="eq" value="1" label="MySQL version too old" type="wrn">
  180. SELECT REPLACE(VERSION(),'-log','') >= '3.23.23'
  181. </test>
  182. ALTER TABLE `{{PREFIX}}post` ADD FULLTEXT `full_post_chapo` (`post_chapo`)
  183. </action>
  184. <!-- FIRST CATEGORY -->
  185. <action id="firstcat" label="Creation of first category">
  186. INSERT INTO `{{PREFIX}}categorie`
  187. (`cat_id`, `cat_libelle`, `cat_libelle_url`, `cat_ord`) VALUES
  188. (1, 'General', 'General', 0)
  189. </action>
  190. <!-- INDEXES
  191. ====================================================== -->
  192. <action id="fk_post_categorie" type="silent">
  193. ALTER TABLE `{{PREFIX}}post` ADD INDEX `fk_post_categorie` (`cat_id`,`post_pub`)
  194. </action>
  195. <action id="fk_post_user" type="silent">
  196. ALTER TABLE `{{PREFIX}}post` ADD INDEX `fk_post_user` (`user_id`,`post_pub`)
  197. </action>
  198. <action id="fk_comment_post" type="silent">
  199. ALTER TABLE `{{PREFIX}}comment` ADD INDEX `fk_comment_post` (`post_id`)
  200. </action>
  201. <action id="fk_ping_post" type="silent">
  202. ALTER TABLE `{{PREFIX}}ping` ADD INDEX `fk_ping_post` (`post_id`)
  203. </action>
  204. </database>