File tree Expand file tree Collapse file tree 1 file changed +35
-2
lines changed Expand file tree Collapse file tree 1 file changed +35
-2
lines changed Original file line number Diff line number Diff line change @@ -48,13 +48,46 @@ class Migration extends Query
4848{
4949 private  $ _sql_up =[];
5050 private  $ _sql_down =[];
51+  private  $ _split_chars =false ;
52+ 
53+  private  function  autoSplit ($ sql )
54+  {
55+  if  ($ this  ->_split_chars )
56+  {
57+  return  explode ($ this  ->_split_chars ,$ sql );
58+  }
59+  return  $ sql ;
60+  }
61+ 
62+  public  function  setAutoSplitQuerty ($ split_chars )
63+  {
64+  $ this  ->_split_chars =$ split_chars ;
65+  }
5166 public  function  addSqlUpdate ($ sql )
5267 {
53-  $ this  ->_sql_up []=$ sql ;
68+  $ sql =$ this  ->autoSplit ($ sql );
69+ 
70+  if  (is_array ($ sql ))
71+  {
72+  foreach  ($ sql  as  $ q ) $ this  ->_sql_up []=trim ($ q );
73+  }
74+  else 
75+  {
76+  $ this  ->_sql_up []=$ sql ;
77+  }
78+ 
5479 }
5580 public  function  addSqlDowngrade ($ sql )
5681 {
57-  $ this  ->_sql_down []=$ sql ;
82+  $ sql =$ this  ->autoSplit ($ sql );
83+  if  (is_array ($ sql ))
84+  {
85+  foreach  ($ sql  as  $ q ) $ this  ->_sql_down []=trim ($ q );
86+  }
87+  else 
88+  {
89+  $ this  ->_sql_down []=$ sql ;
90+  }
5891 }
5992
6093 /** 
                                 You can’t perform that action at this time. 
               
                  
0 commit comments