mirror of
https://github.com/PostgreSQL-For-Wordpress/postgresql-for-wordpress.git
synced 2025-09-26 04:50:54 +02:00
Remove Default character set
This commit is contained in:
@@ -29,6 +29,7 @@ class CreateTableSQLRewriter extends AbstractSQLRewriter
|
|||||||
" 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' => '',
|
||||||
|
' CHARACTER SET utf8' => '',
|
||||||
|
|
||||||
// For flash-album-gallery plugin
|
// For flash-album-gallery plugin
|
||||||
' tinyint' => ' smallint'
|
' tinyint' => ' smallint'
|
||||||
|
@@ -195,6 +195,52 @@ final class rewriteTest extends TestCase
|
|||||||
$this->assertSame(trim($postgresql), trim($expected));
|
$this->assertSame(trim($postgresql), trim($expected));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function test_it_removes_character_sets()
|
||||||
|
{
|
||||||
|
$sql = <<<SQL
|
||||||
|
CREATE TABLE wp_statistics_useronline (
|
||||||
|
ID bigint(20) NOT NULL AUTO_INCREMENT,
|
||||||
|
ip varchar(60) NOT NULL,
|
||||||
|
created int(11),
|
||||||
|
timestamp int(10) NOT NULL,
|
||||||
|
date datetime NOT NULL,
|
||||||
|
referred text CHARACTER SET utf8 NOT NULL,
|
||||||
|
agent varchar(255) NOT NULL,
|
||||||
|
platform varchar(255),
|
||||||
|
version varchar(255),
|
||||||
|
location varchar(10),
|
||||||
|
`user_id` BIGINT(48) NOT NULL,
|
||||||
|
`page_id` BIGINT(48) NOT NULL,
|
||||||
|
`type` VARCHAR(100) NOT NULL,
|
||||||
|
PRIMARY KEY (ID)
|
||||||
|
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci
|
||||||
|
SQL;
|
||||||
|
|
||||||
|
$expected = <<<SQL
|
||||||
|
CREATE TABLE wp_statistics_useronline (
|
||||||
|
"ID" bigserial,
|
||||||
|
ip varchar(60) NOT NULL,
|
||||||
|
created int,
|
||||||
|
timestamp int NOT NULL,
|
||||||
|
date timestamp NOT NULL,
|
||||||
|
referred text NOT NULL,
|
||||||
|
agent varchar(255) NOT NULL,
|
||||||
|
platform varchar(255),
|
||||||
|
version varchar(255),
|
||||||
|
location varchar(10),
|
||||||
|
user_id BIGINT(48) NOT NULL,
|
||||||
|
page_id BIGINT(48) NOT NULL,
|
||||||
|
type VARCHAR(100) NOT NULL,
|
||||||
|
PRIMARY KEY ( "ID" )
|
||||||
|
);
|
||||||
|
SQL;
|
||||||
|
|
||||||
|
$postgresql = pg4wp_rewrite($sql);
|
||||||
|
$this->assertSame(trim($postgresql), trim($expected));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
Reference in New Issue
Block a user