File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -186,7 +186,7 @@ protected function renderAdd() : ?string
186186 }
187187 $ definition = new TableDefinition ($ this ->database );
188188 $ this ->sql ['add ' ]($ definition );
189- return $ definition ->sql ('ADD ' );
189+ return $ definition ->sql ('ADD ' ) ?: null ;
190190 }
191191
192192 /**
@@ -207,7 +207,7 @@ protected function renderChange() : ?string
207207 }
208208 $ definition = new TableDefinition ($ this ->database );
209209 $ this ->sql ['change ' ]($ definition );
210- return $ definition ->sql ('CHANGE ' );
210+ return $ definition ->sql ('CHANGE ' ) ?: null ;
211211 }
212212
213213 /**
@@ -228,7 +228,7 @@ protected function renderModify() : ?string
228228 }
229229 $ definition = new TableDefinition ($ this ->database );
230230 $ this ->sql ['modify ' ]($ definition );
231- return $ definition ->sql ('MODIFY ' );
231+ return $ definition ->sql ('MODIFY ' ) ?: null ;
232232 }
233233
234234 public function dropColumn (string $ name , bool $ ifExists = false ) : static
Original file line number Diff line number Diff line change @@ -67,6 +67,17 @@ public function testAdd() : void
6767 );
6868 }
6969
70+ public function testAddEmpty () : void
71+ {
72+ $ sql = $ this ->alterTable ->table ('t1 ' )
73+ ->add (static function (TableDefinition $ definition ) : void {
74+ });
75+ self ::assertSame (
76+ "ALTER TABLE `t1` \n" ,
77+ $ sql ->sql ()
78+ );
79+ }
80+
7081 public function testChange () : void
7182 {
7283 $ sql = $ this ->alterTable ->table ('t1 ' )
@@ -79,6 +90,17 @@ public function testChange() : void
7990 );
8091 }
8192
93+ public function testChangeEmpty () : void
94+ {
95+ $ sql = $ this ->alterTable ->table ('t1 ' )
96+ ->change (static function (TableDefinition $ definition ) : void {
97+ });
98+ self ::assertSame (
99+ "ALTER TABLE `t1` \n" ,
100+ $ sql ->sql ()
101+ );
102+ }
103+
82104 public function testModify () : void
83105 {
84106 $ sql = $ this ->alterTable ->table ('t1 ' )
@@ -91,6 +113,17 @@ public function testModify() : void
91113 );
92114 }
93115
116+ public function testModifyEmpty () : void
117+ {
118+ $ sql = $ this ->alterTable ->table ('t1 ' )
119+ ->modify (static function (TableDefinition $ definition ) : void {
120+ });
121+ self ::assertSame (
122+ "ALTER TABLE `t1` \n" ,
123+ $ sql ->sql ()
124+ );
125+ }
126+
94127 public function testDropColumnIfExists () : void
95128 {
96129 $ alterTable = $ this ->alterTable ->table ('t1 ' )->dropColumnIfExists ('foo ' );
You can’t perform that action at this time.
0 commit comments