db-upgrade.xml 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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. <!-- LOG -->
  24. <action id="log" label="Create table %s" string="{{PREFIX}}log">
  25. <test eq="neq" value="{{PREFIX}}log" label="Table %s exists"
  26. string="{{PREFIX}}log" type="wrn">SHOW TABLES LIKE '{{PREFIX}}log'</test>
  27. CREATE TABLE `{{PREFIX}}log` (
  28. `user_id` varchar(32) binary NOT NULL default '',
  29. `table` varchar(255) NOT NULL default '',
  30. `key` varchar(255) NOT NULL default '',
  31. `date` datetime NOT NULL default '0000-00-00 00:00:00',
  32. `ip` varchar(15) default NULL,
  33. `log` varchar(255) NOT NULL default ''
  34. ) TYPE=MyISAM
  35. </action>
  36. <!-- LINK -->
  37. <action id="link" label="Create table %s" string="{{PREFIX}}link">
  38. <test eq="neq" value="{{PREFIX}}link" label="Table %s exists"
  39. string="{{PREFIX}}link" type="wrn">SHOW TABLES LIKE '{{PREFIX}}link'</test>
  40. CREATE TABLE `{{PREFIX}}link` (
  41. `link_id` int(11) NOT NULL auto_increment,
  42. `href` varchar(255) NOT NULL default '',
  43. `label` varchar(255) NOT NULL default '',
  44. `title` varchar(255) NOT NULL default '',
  45. `lang` char(2) NOT NULL default '',
  46. `position` int(11) NOT NULL default '0',
  47. PRIMARY KEY (`link_id`)
  48. ) TYPE=MyISAM
  49. </action>
  50. <action id="link_rel" label="Add field %s" string="{{PREFIX}}link.rel">
  51. <test eq="neq" value="rel" label="Field %s exists"
  52. string="{{PREFIX}}link.rel" type="wrn">
  53. SHOW COLUMNS FROM `{{PREFIX}}link` LIKE 'rel'
  54. </test>
  55. ALTER TABLE `{{PREFIX}}link` ADD `rel` varchar(255)
  56. AFTER `lang`
  57. </action>
  58. <!-- PING -->
  59. <action id="ping" label="Create table %s" string="{{PREFIX}}ping">
  60. <test eq="neq" value="{{PREFIX}}ping" label="Table %s exists"
  61. string="{{PREFIX}}ping" type="wrn">SHOW TABLES LIKE '{{PREFIX}}ping'</test>
  62. CREATE TABLE `{{PREFIX}}ping` (
  63. `ping_id` int(11) NOT NULL auto_increment,
  64. `post_id` int(11) NOT NULL default '0',
  65. `ping_url` varchar(255) NOT NULL default '0',
  66. `ping_dt` datetime default NULL,
  67. PRIMARY KEY (`ping_id`)
  68. ) TYPE=MyISAM
  69. </action>
  70. <!-- SESSION -->
  71. <action id="session" label="Create table %s" string="{{PREFIX}}session">
  72. <test eq="neq" value="{{PREFIX}}session" label="Table %s exists"
  73. string="{{PREFIX}}session" type="wrn">SHOW TABLES LIKE '{{PREFIX}}session'</test>
  74. CREATE TABLE `{{PREFIX}}session` (
  75. `ses_id` varchar(32) NOT NULL default '',
  76. `ses_time` int(11) NOT NULL default '0',
  77. `ses_start` int(11) NOT NULL default '0',
  78. `ses_value` text NOT NULL,
  79. PRIMARY KEY (`ses_id`)
  80. ) TYPE=MyISAM
  81. </action>
  82. <!-- USER
  83. ===================================================== -->
  84. <!-- user_lang -->
  85. <action id="user_lang" label="Add field %s" string="{{PREFIX}}user.user_lang">
  86. <test eq="neq" value="user_lang" label="Field %s exists"
  87. string="{{PREFIX}}user.user_lang" type="wrn">
  88. SHOW COLUMNS FROM `{{PREFIX}}user` LIKE 'user_lang'
  89. </test>
  90. ALTER TABLE `{{PREFIX}}user` ADD `user_lang` VARCHAR(3)
  91. </action>
  92. <!-- user_delta -->
  93. <action id="user_delta" label="Add field %s" string="{{PREFIX}}user.user_delta">
  94. <test eq="neq" value="user_delta" label="Field %s exists"
  95. string="{{PREFIX}}user.user_delta" type="wrn">
  96. SHOW COLUMNS FROM `{{PREFIX}}user` LIKE 'user_delta'
  97. </test>
  98. ALTER TABLE `{{PREFIX}}user` ADD `user_delta` INTEGER(1) NOT NULL DEFAULT 0
  99. </action>
  100. <!-- user_post_pub -->
  101. <action id="user_post_pub" label="Add field %s" string="{{PREFIX}}user.user_post_pub">
  102. <test eq="neq" value="user_post_pub" label="Field %s exists"
  103. string="{{PREFIX}}user.user_post_pub" type="wrn">
  104. SHOW COLUMNS FROM `{{PREFIX}}user` LIKE 'user_post_pub'
  105. </test>
  106. ALTER TABLE `{{PREFIX}}user` ADD `user_post_pub` INTEGER(1) NOT NULL DEFAULT 0
  107. </action>
  108. <!-- POST
  109. ===================================================== -->
  110. <!-- post_notes -->
  111. <action id="post_notes" label="Add field %s" string="{{PREFIX}}post.post_notes">
  112. <test eq="neq" value="post_notes" label="Field %s exists"
  113. string="{{PREFIX}}post.post_notes" type="wrn">
  114. SHOW COLUMNS FROM `{{PREFIX}}post` LIKE 'post_notes'
  115. </test>
  116. ALTER TABLE `{{PREFIX}}post` ADD `post_notes` LONGTEXT
  117. AFTER `post_content_wiki`
  118. </action>
  119. <!-- post_lang -->
  120. <action id="post_lang" label="Add field %s" string="{{PREFIX}}post.post_lang">
  121. <test eq="neq" value="post_lang" label="Field %s exists"
  122. string="{{PREFIX}}post.post_lang" type="wrn">
  123. SHOW COLUMNS FROM `{{PREFIX}}post` LIKE 'post_lang'
  124. </test>
  125. ALTER TABLE `{{PREFIX}}post` ADD `post_lang` VARCHAR(5)
  126. </action>
  127. <!-- post_titre_url -->
  128. <action id="post_titre_url" label="Add field %s" string="{{PREFIX}}post.post_titre_url">
  129. <test eq="neq" value="post_titre_url" label="Field %s exists"
  130. string="{{PREFIX}}post.post_titre_url" type="wrn">
  131. SHOW COLUMNS FROM `{{PREFIX}}post` LIKE 'post_titre_url'
  132. </test>
  133. ALTER TABLE `{{PREFIX}}post` ADD `post_titre_url` VARCHAR(255)
  134. AFTER `post_titre`
  135. </action>
  136. <!-- post_selected -->
  137. <action id="post_selected" label="Add field %s" string="{{PREFIX}}post.post_selected">
  138. <test eq="neq" value="post_selected" label="Field %s exists"
  139. string="{{PREFIX}}post.post_selected" type="wrn">
  140. SHOW COLUMNS FROM `{{PREFIX}}post` LIKE 'post_selected'
  141. </test>
  142. ALTER TABLE `{{PREFIX}}post` ADD `post_selected` INTEGER(1) NOT NULL
  143. DEFAULT 0 AFTER `post_pub`
  144. </action>
  145. <!-- post_open_tb -->
  146. <action id="post_open_tb" label="Add field %s" string="{{PREFIX}}post.post_open_tb">
  147. <test eq="neq" value="post_open_tb" label="Field %s exists"
  148. string="{{PREFIX}}post.post_open_tb" type="wrn">
  149. SHOW COLUMNS FROM `{{PREFIX}}post` LIKE 'post_open_tb'
  150. </test>
  151. ALTER TABLE `{{PREFIX}}post` ADD `post_open_tb` INTEGER(1) NOT NULL
  152. DEFAULT 0 AFTER `post_open_comment`
  153. </action>
  154. <!-- nb_trackback -->
  155. <action id="nb_trackback" label="Add field %s" string="{{PREFIX}}post.nb_trackback">
  156. <test eq="neq" value="nb_trackback" label="Field %s exists"
  157. string="{{PREFIX}}post.nb_trackback" type="wrn">
  158. SHOW COLUMNS FROM `{{PREFIX}}post` LIKE 'nb_trackback'
  159. </test>
  160. ALTER TABLE `{{PREFIX}}post` ADD `nb_trackback` INTEGER(11) NOT NULL
  161. DEFAULT 0 AFTER `nb_comment`
  162. </action>
  163. <!-- post_gupddt -->
  164. <action id="post_gupddt" label="Remove field %s" string="{{PREFIX}}post.post_gupddt">
  165. <test eq="eq" value="post_gupddt" label="Field %s not present"
  166. string="{{PREFIX}}post.post_gupddt" type="wrn">
  167. SHOW COLUMNS FROM `{{PREFIX}}post` LIKE 'post_gupddt'
  168. </test>
  169. ALTER TABLE `{{PREFIX}}post` DROP `post_gupddt`
  170. </action>
  171. <!-- CATEGORIE
  172. ===================================================== -->
  173. <!-- cat_ord -->
  174. <action id="cat_ord" label="Add field %s" string="{{PREFIX}}categorie.cat_ord">
  175. <test eq="neq" value="cat_ord" label="Field %s exists"
  176. string="{{PREFIX}}categorie.cat_ord" type="wrn">
  177. SHOW COLUMNS FROM `{{PREFIX}}categorie` LIKE 'cat_ord'
  178. </test>
  179. ALTER TABLE `{{PREFIX}}categorie` ADD `cat_ord` INTEGER
  180. </action>
  181. <!-- upd_open_tb -->
  182. <action id="upd_open_tb" label="Update %s" string="{{PREFIX}}post.post_open_tb">
  183. UPDATE `{{PREFIX}}post` SET `post_open_tb` = `post_open_comment`
  184. </action>
  185. <!-- INDEXES
  186. ====================================================== -->
  187. <action id="fk_post_categorie" type="silent">
  188. ALTER TABLE `{{PREFIX}}post` ADD INDEX `fk_post_categorie` (`cat_id`,`post_pub`)
  189. </action>
  190. <action id="fk_post_user" type="silent">
  191. ALTER TABLE `{{PREFIX}}post` ADD INDEX `fk_post_user` (`user_id`,`post_pub`)
  192. </action>
  193. <action id="fk_comment_post" type="silent">
  194. ALTER TABLE `{{PREFIX}}comment` ADD INDEX `fk_comment_post` (`post_id`)
  195. </action>
  196. <action id="fk_ping_post" type="silent">
  197. ALTER TABLE `{{PREFIX}}ping` ADD INDEX `fk_ping_post` (`post_id`)
  198. </action>
  199. </database>