Ignore duplicate key errors in update-keys.sql
Otherwise, reinstalls can fail. Change-Id: Ie4f7f73152a055f9a8d69970c22795433f564b26
This commit is contained in:
parent
da83f3e91b
commit
d315c3bdb3
3 changed files with 7 additions and 1 deletions
|
|
@ -873,6 +873,9 @@ class DatabaseSqlite extends DatabaseBase {
|
|||
} elseif ( preg_match( '/^\s*DROP INDEX/i', $s ) ) {
|
||||
// DROP INDEX is database-wide, not table-specific, so no ON <table> clause.
|
||||
$s = preg_replace( '/\sON\s+[^\s]*/i', '', $s );
|
||||
} elseif ( preg_match( '/^\s*INSERT IGNORE\b/i', $s ) ) {
|
||||
// INSERT IGNORE --> INSERT OR IGNORE
|
||||
$s = preg_replace( '/^\s*INSERT IGNORE\b/i', 'INSERT OR IGNORE', $s );
|
||||
}
|
||||
|
||||
return $s;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
-- table prefix if any when running these scripts.
|
||||
--
|
||||
|
||||
INSERT INTO /*_*/updatelog
|
||||
INSERT IGNORE INTO /*_*/updatelog
|
||||
SELECT 'filearchive-fa_major_mime-patch-fa_major_mime-chemical.sql' AS ul_key, null as ul_value
|
||||
UNION SELECT 'image-img_major_mime-patch-img_major_mime-chemical.sql', null
|
||||
UNION SELECT 'oldimage-oi_major_mime-patch-oi_major_mime-chemical.sql', null
|
||||
|
|
|
|||
|
|
@ -162,6 +162,9 @@ class DatabaseSqliteTest extends MediaWikiTestCase {
|
|||
$this->assertEquals( "DROP INDEX foo -- dropping index",
|
||||
$this->replaceVars( "DROP INDEX /*i*/foo ON /*_*/bar -- dropping index" )
|
||||
);
|
||||
$this->assertEquals( "INSERT OR IGNORE INTO foo VALUES ('bar')",
|
||||
$this->replaceVars( "INSERT OR IGNORE INTO foo VALUES ('bar')" )
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue