@@ -760,6 +760,54 @@ func (s *SqliteMigrateSuite) TestGetMigrationDbMapWithDisableCreateTable(c *C) {
760
760
c .Assert (err , IsNil )
761
761
}
762
762
763
+ // If ms.DisableCreateTable == true, then the the migrations table should not be
764
+ // created, regardless of the global migSet.DisableCreateTable setting.
765
+ func (s * SqliteMigrateSuite ) TestGetMigrationObjDbMapWithDisableCreateTableTrue (c * C ) {
766
+ SetDisableCreateTable (false )
767
+ ms := MigrationSet {
768
+ DisableCreateTable : true ,
769
+ TableName : "silly_example_table" ,
770
+ }
771
+ c .Assert (migSet .DisableCreateTable , Equals , false )
772
+ c .Assert (ms .DisableCreateTable , Equals , true )
773
+
774
+ dbMap , err := ms .getMigrationDbMap (s .Db , "sqlite3" )
775
+ c .Assert (err , IsNil )
776
+ c .Assert (dbMap , NotNil )
777
+
778
+ tableNameIfExists , err := s .DbMap .SelectNullStr (
779
+ "SELECT name FROM sqlite_master WHERE type='table' AND name=$1" ,
780
+ ms .TableName ,
781
+ )
782
+ c .Assert (err , IsNil )
783
+ c .Assert (tableNameIfExists .Valid , Equals , false )
784
+ }
785
+
786
+ // If ms.DisableCreateTable == false, then the the migrations table should not be
787
+ // created, regardless of the global migSet.DisableCreateTable setting.
788
+ func (s * SqliteMigrateSuite ) TestGetMigrationObjDbMapWithDisableCreateTableFalse (c * C ) {
789
+ SetDisableCreateTable (true )
790
+ defer SetDisableCreateTable (false ) // reset the global state when the test ends.
791
+ ms := MigrationSet {
792
+ DisableCreateTable : false ,
793
+ TableName : "silly_example_table" ,
794
+ }
795
+ c .Assert (migSet .DisableCreateTable , Equals , true )
796
+ c .Assert (ms .DisableCreateTable , Equals , false )
797
+
798
+ dbMap , err := ms .getMigrationDbMap (s .Db , "sqlite3" )
799
+ c .Assert (err , IsNil )
800
+ c .Assert (dbMap , NotNil )
801
+
802
+ tableNameIfExists , err := s .DbMap .SelectNullStr (
803
+ "SELECT name FROM sqlite_master WHERE type='table' AND name=$1" ,
804
+ ms .TableName ,
805
+ )
806
+ c .Assert (err , IsNil )
807
+ c .Assert (tableNameIfExists .Valid , Equals , true )
808
+ c .Assert (tableNameIfExists .String , Equals , ms .TableName )
809
+ }
810
+
763
811
func (s * SqliteMigrateSuite ) TestContextTimeout (c * C ) {
764
812
// This statement will run for a long time: 1,000,000 iterations of the fibonacci sequence
765
813
fibonacciLoopStmt := `WITH RECURSIVE
0 commit comments