@@ -30,34 +30,18 @@ describe('ColumnDefinitions', () => {
30
30
b = ColumnDefinitions . blob ( ) ;
31
31
a . $equals ( b ) . should . be . false ( ) ;
32
32
33
- a = ColumnDefinitions . blob ( ) . defaultRaw ( 'a' ) ;
34
- b = ColumnDefinitions . blob ( ) ;
35
- a . $equals ( b ) . should . be . false ( ) ;
36
-
37
33
a = ColumnDefinitions . blob ( ) . default ( 'a' ) ;
38
34
b = ColumnDefinitions . blob ( ) . default ( 'a' ) ;
39
35
a . $equals ( b ) . should . be . true ( ) ;
40
36
41
- a = ColumnDefinitions . blob ( ) . defaultRaw ( 'a' ) ;
42
- b = ColumnDefinitions . blob ( ) . defaultRaw ( 'a' ) ;
43
- a . $equals ( b ) . should . be . true ( ) ;
44
-
45
37
a = ColumnDefinitions . blob ( ) . notNull ( ) ;
46
38
b = ColumnDefinitions . blob ( ) . notNull ( ) . default ( 'a' ) ;
47
39
a . $equals ( b ) . should . be . false ( ) ;
48
40
49
- a = ColumnDefinitions . blob ( ) . notNull ( ) ;
50
- b = ColumnDefinitions . blob ( ) . notNull ( ) . defaultRaw ( 'a' ) ;
51
- a . $equals ( b ) . should . be . false ( ) ;
52
-
53
41
a = ColumnDefinitions . blob ( ) . notNull ( ) . default ( 'a' ) ;
54
42
b = ColumnDefinitions . blob ( ) . notNull ( ) . default ( 'b' ) ;
55
43
a . $equals ( b ) . should . be . false ( ) ;
56
44
57
- a = ColumnDefinitions . blob ( ) . notNull ( ) . defaultRaw ( 'a' ) ;
58
- b = ColumnDefinitions . blob ( ) . notNull ( ) . defaultRaw ( 'b' ) ;
59
- a . $equals ( b ) . should . be . false ( ) ;
60
-
61
45
a = ColumnDefinitions . int ( ) . unsigned ( ) . zerofill ( ) . notNull ( ) . default ( 2 ) . autoIncrement ( ) ;
62
46
b = ColumnDefinitions . int ( ) . unsigned ( ) . zerofill ( ) . notNull ( ) . default ( 2 ) . autoIncrement ( ) ;
63
47
a . $equals ( b ) . should . be . true ( ) ;
@@ -374,28 +358,10 @@ describe('ColumnDefinitions', () => {
374
358
cd = ColumnDefinitions . timestamp ( ) . default ( 'CURRENT_TIMESTAMP' ) ;
375
359
cd . $toSQL ( ) . should . equal ( 'timestamp DEFAULT \'CURRENT_TIMESTAMP\'' ) ;
376
360
377
- cd = ColumnDefinitions . datetime ( ) . notNull ( ) . defaultRaw ( 'NOW()' ) ;
378
- cd . $toSQL ( ) . should . equal ( 'datetime NOT NULL DEFAULT NOW()' ) ;
379
-
380
- cd = ColumnDefinitions . timestamp ( ) . notNull ( ) . defaultRaw ( 'CURRENT_TIMESTAMP' ) ;
381
- cd . $toSQL ( ) . should . equal ( 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP' ) ;
382
-
383
- cd = ColumnDefinitions . tinyint ( ) . notNull ( ) . defaultRaw ( '1' ) ;
384
- cd . $toSQL ( ) . should . equal ( 'tinyint NOT NULL DEFAULT 1' ) ;
385
-
386
361
cd = ColumnDefinitions . datetime ( ) . default ( '1970-01-01 00:00:01' ) ;
387
362
cd . $toSQL ( ) . should . equal ( 'datetime DEFAULT \'1970-01-01 00:00:01\'' ) ;
388
363
} ) ;
389
364
390
- it ( 'should throw if the value passed to `.defaultRaw()` is not a string' , ( ) => {
391
- should . throws ( ( ) => ColumnDefinitions . int ( ) . defaultRaw ( 1 ) , / d e f a u l t R a w .+ m u s t b e a s t r i n g / ) ;
392
- should . throws ( ( ) => ColumnDefinitions . int ( ) . defaultRaw ( [ 1 ] ) , / d e f a u l t R a w .+ m u s t b e a s t r i n g / ) ;
393
- should . throws ( ( ) => ColumnDefinitions . int ( ) . defaultRaw ( null ) , / d e f a u l t R a w .+ m u s t b e a s t r i n g / ) ;
394
- should . throws ( ( ) => ColumnDefinitions . int ( ) . defaultRaw ( undefined ) , / d e f a u l t R a w .+ m u s t b e a s t r i n g / ) ;
395
- should . throws ( ( ) => ColumnDefinitions . int ( ) . defaultRaw ( true ) , / d e f a u l t R a w .+ m u s t b e a s t r i n g / ) ;
396
- should . throws ( ( ) => ColumnDefinitions . int ( ) . defaultRaw ( false ) , / d e f a u l t R a w .+ m u s t b e a s t r i n g / ) ;
397
- } ) ;
398
-
399
365
it ( 'should allow the columns to be defined as keys, but not change the SQL' , ( ) => {
400
366
var cd ;
401
367
0 commit comments