r68474 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68473‎ | r68474 | r68475 >
Date:18:59, 23 June 2010
Author:maxsem
Status:ok
Tags:
Comment:
Converting MySQL's ENUM to SQLite BLOB doesn't make sense, changed it to TEXT. Also fixed a bug in conversion regex
Modified paths:
  • /trunk/phase3/includes/db/DatabaseSqlite.php (modified) (history)
  • /trunk/phase3/maintenance/tests/DatabaseSqliteTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/tests/DatabaseSqliteTest.php
@@ -49,7 +49,11 @@
5050 $this->replaceVars( "CREATE TABLE text ( text_foo tinytext );" ),
5151 'Table name changed'
5252 );
53 -
 53+
 54+ $this->assertEquals( "CREATE TABLE enums( enum1 TEXT, myenum TEXT)",
 55+ $this->replaceVars( "CREATE TABLE enums( enum1 ENUM('A', 'B'), myenum ENUM ('X', 'Y'))" )
 56+ );
 57+
5458 $this->assertEquals( "ALTER TABLE foo ADD COLUMN foo_bar INTEGER DEFAULT 42",
5559 $this->replaceVars( "ALTER TABLE foo\nADD COLUMN foo_bar int(10) unsigned DEFAULT 42" )
5660 );
Index: trunk/phase3/includes/db/DatabaseSqlite.php
@@ -562,7 +562,7 @@
563563 // DATETIME -> TEXT
564564 $s = preg_replace( '/\b(datetime|timestamp)\b/i', 'TEXT', $s );
565565 // No ENUM type
566 - $s = preg_replace( '/enum\([^)]*\)/i', 'BLOB', $s );
 566+ $s = preg_replace( '/\benum\s*\([^)]*\)/i', 'TEXT', $s );
567567 // binary collation type -> nothing
568568 $s = preg_replace( '/\bbinary\b/i', '', $s );
569569 // auto_increment -> autoincrement

Status & tagging log