File tree Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -122,25 +122,25 @@ protected function getMigrationHistory($limit)
122122 */
123123 protected function addMigrationHistory ($ version )
124124 {
125- $ command = $ this ->db ->createCommand ();
126- $ command ->insert ($ this ->migrationTable , [
127- 'version ' => $ version ,
128- 'apply_time ' => time (),
129- 'is_deleted ' => 0
130- ])->execute ();
125+ $ this ->insertHistory ($ version );
131126 }
132127
133128 /**
134129 * @inheritdoc
135130 */
136131 protected function removeMigrationHistory ($ version )
137132 {
138- $ command = $ this ->db ->createCommand ();
139- $ command ->insert ($ this ->migrationTable , [
133+ $ this ->insertHistory ($ version , true );
134+ }
135+
136+ private function insertHistory (string $ version , bool $ isDelete = false ): void
137+ {
138+ $ time = time ();
139+ $ this ->db ->createCommand ()->insert ($ this ->migrationTable , [
140140 'version ' => $ version ,
141- 'apply_time ' => time (),
142- 'is_deleted ' => 1
141+ 'date ' => date ('Y-m-d ' , $ time ),
142+ 'apply_time ' => $ time ,
143+ 'is_deleted ' => (int ) $ isDelete
143144 ])->execute ();
144145 }
145-
146146}
You can’t perform that action at this time.
0 commit comments