@@ -45,4 +45,100 @@ public function testChangeBinaryColumnSize(): void
4545 $ this ->migrator ->rollback ();
4646 $ this ->assertFalse ($ this ->db ->hasTable ('sample ' ));
4747 }
48+
49+ public function testUnsigned (): void
50+ {
51+ $ this ->migrator ->configure ();
52+
53+ $ schema = $ this ->schema ('sample ' );
54+ $ schema ->primary ('id ' );
55+ $ schema ->integer ('int ' );
56+ $ schema ->integer ('int_unsigned ' , unsigned: true );
57+ $ schema ->tinyInteger ('tiny_integer_unsigned ' , unsigned: true );
58+ $ schema ->smallInteger ('small_integer_unsigned ' , unsigned: true );
59+ $ schema ->smallInteger ('big_integer_unsigned ' , unsigned: true );
60+ $ this ->atomize ('migration1 ' , [$ schema ]);
61+
62+ $ this ->migrator ->run ();
63+ $ this ->assertFalse ($ this ->schema ('sample ' )->column ('int ' )->isUnsigned ());
64+ $ this ->assertTrue ($ this ->schema ('sample ' )->column ('int_unsigned ' )->isUnsigned ());
65+ $ this ->assertTrue ($ this ->schema ('sample ' )->column ('tiny_integer_unsigned ' )->isUnsigned ());
66+ $ this ->assertTrue ($ this ->schema ('sample ' )->column ('small_integer_unsigned ' )->isUnsigned ());
67+ $ this ->assertTrue ($ this ->schema ('sample ' )->column ('big_integer_unsigned ' )->isUnsigned ());
68+
69+ $ schema = $ this ->schema ('sample ' );
70+ $ schema ->integer ('int ' , unsigned: true );
71+ $ schema ->integer ('int_unsigned ' , unsigned: false );
72+ $ schema ->tinyInteger ('tiny_integer_unsigned ' , unsigned: false );
73+ $ schema ->smallInteger ('small_integer_unsigned ' , unsigned: false );
74+ $ schema ->smallInteger ('big_integer_unsigned ' , unsigned: false );
75+ $ this ->atomize ('migration2 ' , [$ schema ]);
76+
77+ $ this ->migrator ->run ();
78+
79+ $ this ->assertTrue ($ this ->schema ('sample ' )->column ('int ' )->isUnsigned ());
80+ $ this ->assertFalse ($ this ->schema ('sample ' )->column ('int_unsigned ' )->isUnsigned ());
81+ $ this ->assertFalse ($ this ->schema ('sample ' )->column ('tiny_integer_unsigned ' )->isUnsigned ());
82+ $ this ->assertFalse ($ this ->schema ('sample ' )->column ('small_integer_unsigned ' )->isUnsigned ());
83+ $ this ->assertFalse ($ this ->schema ('sample ' )->column ('big_integer_unsigned ' )->isUnsigned ());
84+
85+ $ this ->migrator ->rollback ();
86+
87+ $ this ->assertFalse ($ this ->schema ('sample ' )->column ('int ' )->isUnsigned ());
88+ $ this ->assertTrue ($ this ->schema ('sample ' )->column ('int_unsigned ' )->isUnsigned ());
89+ $ this ->assertTrue ($ this ->schema ('sample ' )->column ('tiny_integer_unsigned ' )->isUnsigned ());
90+ $ this ->assertTrue ($ this ->schema ('sample ' )->column ('small_integer_unsigned ' )->isUnsigned ());
91+ $ this ->assertTrue ($ this ->schema ('sample ' )->column ('big_integer_unsigned ' )->isUnsigned ());
92+
93+ $ this ->migrator ->rollback ();
94+ $ this ->assertFalse ($ this ->db ->hasTable ('sample ' ));
95+ }
96+
97+ public function testZerofill (): void
98+ {
99+ $ this ->migrator ->configure ();
100+
101+ $ schema = $ this ->schema ('sample ' );
102+ $ schema ->primary ('id ' );
103+ $ schema ->integer ('int ' );
104+ $ schema ->integer ('int_zerofill ' , zerofill: true );
105+ $ schema ->tinyInteger ('tiny_integer_zerofill ' , zerofill: true );
106+ $ schema ->smallInteger ('small_integer_zerofill ' , zerofill: true );
107+ $ schema ->smallInteger ('big_integer_zerofill ' , zerofill: true );
108+ $ this ->atomize ('migration1 ' , [$ schema ]);
109+
110+ $ this ->migrator ->run ();
111+ $ this ->assertFalse ($ this ->schema ('sample ' )->column ('int ' )->isZerofill ());
112+ $ this ->assertTrue ($ this ->schema ('sample ' )->column ('int_zerofill ' )->isZerofill ());
113+ $ this ->assertTrue ($ this ->schema ('sample ' )->column ('tiny_integer_zerofill ' )->isZerofill ());
114+ $ this ->assertTrue ($ this ->schema ('sample ' )->column ('small_integer_zerofill ' )->isZerofill ());
115+ $ this ->assertTrue ($ this ->schema ('sample ' )->column ('big_integer_zerofill ' )->isZerofill ());
116+
117+ $ schema = $ this ->schema ('sample ' );
118+ $ schema ->integer ('int ' , zerofill: true );
119+ $ schema ->integer ('int_zerofill ' , zerofill: false );
120+ $ schema ->tinyInteger ('tiny_integer_zerofill ' , zerofill: false );
121+ $ schema ->smallInteger ('small_integer_zerofill ' , zerofill: false );
122+ $ schema ->smallInteger ('big_integer_zerofill ' , zerofill: false );
123+ $ this ->atomize ('migration2 ' , [$ schema ]);
124+
125+ $ this ->migrator ->run ();
126+
127+ $ this ->assertTrue ($ this ->schema ('sample ' )->column ('int ' )->isZerofill ());
128+ $ this ->assertFalse ($ this ->schema ('sample ' )->column ('int_zerofill ' )->isZerofill ());
129+ $ this ->assertFalse ($ this ->schema ('sample ' )->column ('tiny_integer_zerofill ' )->isZerofill ());
130+ $ this ->assertFalse ($ this ->schema ('sample ' )->column ('small_integer_zerofill ' )->isZerofill ());
131+ $ this ->assertFalse ($ this ->schema ('sample ' )->column ('big_integer_zerofill ' )->isZerofill ());
132+
133+ $ this ->migrator ->rollback ();
134+
135+ $ this ->assertFalse ($ this ->schema ('sample ' )->column ('int ' )->isZerofill ());
136+ $ this ->assertTrue ($ this ->schema ('sample ' )->column ('int_zerofill ' )->isZerofill ());
137+ $ this ->assertTrue ($ this ->schema ('sample ' )->column ('tiny_integer_zerofill ' )->isZerofill ());
138+ $ this ->assertTrue ($ this ->schema ('sample ' )->column ('small_integer_zerofill ' )->isZerofill ());
139+ $ this ->assertTrue ($ this ->schema ('sample ' )->column ('big_integer_zerofill ' )->isZerofill ());
140+
141+ $ this ->migrator ->rollback ();
142+ $ this ->assertFalse ($ this ->db ->hasTable ('sample ' ));
143+ }
48144}
0 commit comments