mirror of
https://github.com/PostgreSQL-For-Wordpress/postgresql-for-wordpress.git
synced 2025-07-30 01:37:13 +02:00
Add space before replacements to avoid any issues with similar types
This commit is contained in:
@ -3,30 +3,32 @@
|
||||
class AlterTableSQLRewriter extends AbstractSQLRewriter
|
||||
{
|
||||
private $stringReplacements = [
|
||||
'bigint(20)' => 'bigint',
|
||||
'bigint(10)' => 'int',
|
||||
'int(11)' => 'int',
|
||||
'tinytext' => 'text',
|
||||
'mediumtext' => 'text',
|
||||
'longtext' => 'text',
|
||||
'unsigned' => '',
|
||||
' bigint(40)' => ' bigint',
|
||||
' bigint(20)' => ' bigint',
|
||||
' bigint(10)' => ' int',
|
||||
' int(11)' => ' int',
|
||||
' int(10)' => ' int',
|
||||
' tinytext' => ' text',
|
||||
' mediumtext' => ' text',
|
||||
' longtext' => ' text',
|
||||
' unsigned' => ' ',
|
||||
'gmt datetime NOT NULL default \'0000-00-00 00:00:00\'' => 'gmt timestamp NOT NULL DEFAULT timezone(\'gmt\'::text, now())',
|
||||
'default \'0000-00-00 00:00:00\'' => 'DEFAULT now()',
|
||||
'\'0000-00-00 00:00:00\'' => 'now()',
|
||||
'datetime' => 'timestamp',
|
||||
' datetime' => ' timestamp',
|
||||
'DEFAULT CHARACTER SET utf8' => '',
|
||||
|
||||
// WP 2.7.1 compatibility
|
||||
'int(4)' => 'smallint',
|
||||
' int(4)' => ' smallint',
|
||||
|
||||
// For WPMU (starting with WP 3.2)
|
||||
'tinyint(2)' => 'smallint',
|
||||
'tinyint(1)' => 'smallint',
|
||||
"enum('0','1')" => 'smallint',
|
||||
'COLLATE utf8_general_ci' => '',
|
||||
' tinyint(2)' => ' smallint',
|
||||
' tinyint(1)' => ' smallint',
|
||||
" enum('0','1')" => ' smallint',
|
||||
' COLLATE utf8_general_ci' => ' ',
|
||||
|
||||
// For flash-album-gallery plugin
|
||||
'tinyint' => 'smallint'
|
||||
' tinyint' => ' smallint'
|
||||
];
|
||||
|
||||
public function rewrite(): string
|
||||
|
@ -3,14 +3,16 @@
|
||||
class CreateTableSQLRewriter extends AbstractSQLRewriter
|
||||
{
|
||||
private $stringReplacements = [
|
||||
'bigint(20)' => 'bigint',
|
||||
'bigint(10)' => 'int',
|
||||
'int(11)' => 'int',
|
||||
'int(1)' => 'smallint',
|
||||
'tinytext' => 'text',
|
||||
'mediumtext' => 'text',
|
||||
'longtext' => 'text',
|
||||
'unsigned' => '',
|
||||
' bigint(40)' => ' bigint',
|
||||
' bigint(20)' => ' bigint',
|
||||
' bigint(10)' => ' int',
|
||||
' int(11)' => ' int',
|
||||
' int(10)' => ' int',
|
||||
' int(1)' => ' smallint',
|
||||
' tinytext' => ' text',
|
||||
' mediumtext' => ' text',
|
||||
' longtext' => ' text',
|
||||
' unsigned' => ' ',
|
||||
'gmt datetime NOT NULL default \'0000-00-00 00:00:00\'' => 'gmt timestamp NOT NULL DEFAULT timezone(\'gmt\'::text, now())',
|
||||
'default \'0000-00-00 00:00:00\'' => 'DEFAULT now()',
|
||||
'\'0000-00-00 00:00:00\'' => 'now()',
|
||||
@ -19,17 +21,17 @@ class CreateTableSQLRewriter extends AbstractSQLRewriter
|
||||
'DEFAULT CHARACTER SET utf8' => '',
|
||||
|
||||
// WP 2.7.1 compatibility
|
||||
'int(4)' => 'smallint',
|
||||
' int(4)' => ' smallint',
|
||||
|
||||
// For WPMU (starting with WP 3.2)
|
||||
'tinyint(2)' => 'smallint',
|
||||
'tinyint(1)' => 'smallint',
|
||||
"enum('0','1')" => 'smallint',
|
||||
' tinyint(2)' => ' smallint',
|
||||
' tinyint(1)' => ' smallint',
|
||||
" enum('0','1')" => ' smallint',
|
||||
'COLLATE utf8mb4_unicode_520_ci' => '',
|
||||
'COLLATE utf8_general_ci' => '',
|
||||
|
||||
// For flash-album-gallery plugin
|
||||
'tinyint' => 'smallint'
|
||||
' tinyint' => ' smallint'
|
||||
];
|
||||
|
||||
public function rewrite(): string
|
||||
|
Reference in New Issue
Block a user