mirror of
https://github.com/PostgreSQL-For-Wordpress/postgresql-for-wordpress.git
synced 2025-07-31 10:17: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
|
class AlterTableSQLRewriter extends AbstractSQLRewriter
|
||||||
{
|
{
|
||||||
private $stringReplacements = [
|
private $stringReplacements = [
|
||||||
'bigint(20)' => 'bigint',
|
' bigint(40)' => ' bigint',
|
||||||
'bigint(10)' => 'int',
|
' bigint(20)' => ' bigint',
|
||||||
'int(11)' => 'int',
|
' bigint(10)' => ' int',
|
||||||
'tinytext' => 'text',
|
' int(11)' => ' int',
|
||||||
'mediumtext' => 'text',
|
' int(10)' => ' int',
|
||||||
'longtext' => 'text',
|
' tinytext' => ' text',
|
||||||
'unsigned' => '',
|
' 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())',
|
'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()',
|
'default \'0000-00-00 00:00:00\'' => 'DEFAULT now()',
|
||||||
'\'0000-00-00 00:00:00\'' => 'now()',
|
'\'0000-00-00 00:00:00\'' => 'now()',
|
||||||
'datetime' => 'timestamp',
|
' datetime' => ' timestamp',
|
||||||
'DEFAULT CHARACTER SET utf8' => '',
|
'DEFAULT CHARACTER SET utf8' => '',
|
||||||
|
|
||||||
// WP 2.7.1 compatibility
|
// WP 2.7.1 compatibility
|
||||||
'int(4)' => 'smallint',
|
' int(4)' => ' smallint',
|
||||||
|
|
||||||
// For WPMU (starting with WP 3.2)
|
// For WPMU (starting with WP 3.2)
|
||||||
'tinyint(2)' => 'smallint',
|
' tinyint(2)' => ' smallint',
|
||||||
'tinyint(1)' => 'smallint',
|
' tinyint(1)' => ' smallint',
|
||||||
"enum('0','1')" => 'smallint',
|
" enum('0','1')" => ' smallint',
|
||||||
'COLLATE utf8_general_ci' => '',
|
' COLLATE utf8_general_ci' => ' ',
|
||||||
|
|
||||||
// For flash-album-gallery plugin
|
// For flash-album-gallery plugin
|
||||||
'tinyint' => 'smallint'
|
' tinyint' => ' smallint'
|
||||||
];
|
];
|
||||||
|
|
||||||
public function rewrite(): string
|
public function rewrite(): string
|
||||||
|
@ -3,14 +3,16 @@
|
|||||||
class CreateTableSQLRewriter extends AbstractSQLRewriter
|
class CreateTableSQLRewriter extends AbstractSQLRewriter
|
||||||
{
|
{
|
||||||
private $stringReplacements = [
|
private $stringReplacements = [
|
||||||
'bigint(20)' => 'bigint',
|
' bigint(40)' => ' bigint',
|
||||||
'bigint(10)' => 'int',
|
' bigint(20)' => ' bigint',
|
||||||
'int(11)' => 'int',
|
' bigint(10)' => ' int',
|
||||||
'int(1)' => 'smallint',
|
' int(11)' => ' int',
|
||||||
'tinytext' => 'text',
|
' int(10)' => ' int',
|
||||||
'mediumtext' => 'text',
|
' int(1)' => ' smallint',
|
||||||
'longtext' => 'text',
|
' tinytext' => ' text',
|
||||||
'unsigned' => '',
|
' 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())',
|
'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()',
|
'default \'0000-00-00 00:00:00\'' => 'DEFAULT now()',
|
||||||
'\'0000-00-00 00:00:00\'' => 'now()',
|
'\'0000-00-00 00:00:00\'' => 'now()',
|
||||||
@ -19,17 +21,17 @@ class CreateTableSQLRewriter extends AbstractSQLRewriter
|
|||||||
'DEFAULT CHARACTER SET utf8' => '',
|
'DEFAULT CHARACTER SET utf8' => '',
|
||||||
|
|
||||||
// WP 2.7.1 compatibility
|
// WP 2.7.1 compatibility
|
||||||
'int(4)' => 'smallint',
|
' int(4)' => ' smallint',
|
||||||
|
|
||||||
// For WPMU (starting with WP 3.2)
|
// For WPMU (starting with WP 3.2)
|
||||||
'tinyint(2)' => 'smallint',
|
' tinyint(2)' => ' smallint',
|
||||||
'tinyint(1)' => 'smallint',
|
' tinyint(1)' => ' smallint',
|
||||||
"enum('0','1')" => 'smallint',
|
" enum('0','1')" => ' smallint',
|
||||||
'COLLATE utf8mb4_unicode_520_ci' => '',
|
'COLLATE utf8mb4_unicode_520_ci' => '',
|
||||||
'COLLATE utf8_general_ci' => '',
|
'COLLATE utf8_general_ci' => '',
|
||||||
|
|
||||||
// For flash-album-gallery plugin
|
// For flash-album-gallery plugin
|
||||||
'tinyint' => 'smallint'
|
' tinyint' => ' smallint'
|
||||||
];
|
];
|
||||||
|
|
||||||
public function rewrite(): string
|
public function rewrite(): string
|
||||||
|
Reference in New Issue
Block a user