@@ -96,6 +96,29 @@ public function test_it_handles_auto_increment_without_null()
96
96
$ this ->assertSame (trim ($ expected ), trim ($ postgresql ));
97
97
}
98
98
99
+ public function test_it_handles_numerics_without_auto_incrment_case_insensitively ()
100
+ {
101
+ $ sql = <<<SQL
102
+ CREATE TABLE IF NOT EXISTS stars_votes (
103
+ voter_ip VARCHAR(150) NOT NULL,
104
+ post_id BIGINT(20) UNSIGNED NOT NULL,
105
+ rating INT(1) UNSIGNED NOT NULL,
106
+ PRIMARY KEY (voter_ip, post_id)
107
+ )
108
+ SQL ;
109
+
110
+ $ expected = <<<SQL
111
+ CREATE TABLE IF NOT EXISTS stars_votes (
112
+ voter_ip VARCHAR(150) NOT NULL,
113
+ post_id BIGINT NOT NULL,
114
+ rating INT NOT NULL,
115
+ PRIMARY KEY (voter_ip, post_id)
116
+ );
117
+ SQL ;
118
+
119
+ $ postgresql = pg4wp_rewrite ($ sql );
120
+ $ this ->assertSame (trim ($ expected ), trim ($ postgresql ));
121
+ }
99
122
100
123
public function test_it_handles_keys ()
101
124
{
@@ -229,8 +252,8 @@ public function test_it_removes_character_sets()
229
252
platform varchar(255),
230
253
version varchar(255),
231
254
location varchar(10),
232
- user_id BIGINT(48) NOT NULL,
233
- page_id BIGINT(48) NOT NULL,
255
+ user_id BIGINT NOT NULL,
256
+ page_id BIGINT NOT NULL,
234
257
type VARCHAR(100) NOT NULL,
235
258
PRIMARY KEY ( "ID" )
236
259
);
@@ -631,6 +654,63 @@ public function test_it_can_handle_insert_sql_containing_nested_parathesis_with_
631
654
$ this ->assertSame (trim ($ expected ), trim ($ postgresql ));
632
655
}
633
656
657
+ public function test_it_rewrites_mediumints ()
658
+ {
659
+ $ sql = <<<SQL
660
+ CREATE TABLE wp_relevanssi (
661
+ doc bigint(20) NOT NULL DEFAULT '0',
662
+ term varchar(50) NOT NULL DEFAULT '0',
663
+ term_reverse varchar(50) NOT NULL DEFAULT '0',
664
+ content mediumint(9) NOT NULL DEFAULT '0',
665
+ title mediumint(9) NOT NULL DEFAULT '0',
666
+ comment mediumint(9) NOT NULL DEFAULT '0',
667
+ tag mediumint(9) NOT NULL DEFAULT '0',
668
+ link mediumint(9) NOT NULL DEFAULT '0',
669
+ author mediumint(9) NOT NULL DEFAULT '0',
670
+ category mediumint(9) NOT NULL DEFAULT '0',
671
+ excerpt mediumint(9) NOT NULL DEFAULT '0',
672
+ taxonomy mediumint(9) NOT NULL DEFAULT '0',
673
+ customfield mediumint(9) NOT NULL DEFAULT '0',
674
+ mysqlcolumn MEDIUMINT(9) NOT NULL DEFAULT '0',
675
+ taxonomy_detail longtext NOT NULL,
676
+ customfield_detail longtext NOT NULL DEFAULT '',
677
+ mysqlcolumn_detail longtext NOT NULL DEFAULT '',
678
+ type varchar(210) NOT NULL DEFAULT 'post',
679
+ item bigint(20) NOT NULL DEFAULT '0',
680
+ PRIMARY KEY doctermitem (doc, term, item)
681
+ ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci
682
+ SQL ;
683
+
684
+ $ expected = <<<SQL
685
+ CREATE TABLE IF NOT EXISTS wp_relevanssi (
686
+ doc bigint NOT NULL DEFAULT '0',
687
+ term varchar(50) NOT NULL DEFAULT '0',
688
+ term_reverse varchar(50) NOT NULL DEFAULT '0',
689
+ content integer NOT NULL DEFAULT '0',
690
+ title integer NOT NULL DEFAULT '0',
691
+ comment integer NOT NULL DEFAULT '0',
692
+ tag integer NOT NULL DEFAULT '0',
693
+ link integer NOT NULL DEFAULT '0',
694
+ author integer NOT NULL DEFAULT '0',
695
+ category integer NOT NULL DEFAULT '0',
696
+ excerpt integer NOT NULL DEFAULT '0',
697
+ taxonomy integer NOT NULL DEFAULT '0',
698
+ customfield integer NOT NULL DEFAULT '0',
699
+ mysqlcolumn integer NOT NULL DEFAULT '0',
700
+ taxonomy_detail text NOT NULL,
701
+ customfield_detail text NOT NULL DEFAULT '',
702
+ mysqlcolumn_detail text NOT NULL DEFAULT '',
703
+ type varchar(210) NOT NULL DEFAULT 'post',
704
+ item bigint NOT NULL DEFAULT '0',
705
+ PRIMARY KEY doctermitem (doc, term, item)
706
+ );
707
+ SQL ;
708
+
709
+ $ postgresql = pg4wp_rewrite ($ sql );
710
+ $ this ->assertSame (trim ($ expected ), trim ($ postgresql ));
711
+ }
712
+
713
+
634
714
635
715
636
716
0 commit comments