@@ -461,3 +461,105 @@ Harness.test({
461
461
params : [ ]
462
462
} ) ;
463
463
464
+ // UNIQUE COLUMN TESTS
465
+ Harness . test ( {
466
+ query : Table . define ( {
467
+ name : 'post' ,
468
+ columns : [ {
469
+ name : 'id' ,
470
+ dataType : 'int' ,
471
+ //primaryKey: true,
472
+ //notNull: true,
473
+ unique : true
474
+ } ]
475
+ } ) . create ( ) ,
476
+ pg : {
477
+ text : 'CREATE TABLE "post" ("id" int UNIQUE)' ,
478
+ string : 'CREATE TABLE "post" ("id" int UNIQUE)'
479
+ } ,
480
+ sqlite : {
481
+ text : 'CREATE TABLE "post" ("id" int UNIQUE)' ,
482
+ string : 'CREATE TABLE "post" ("id" int UNIQUE)'
483
+ } ,
484
+ mysql : {
485
+ text : 'CREATE TABLE `post` (`id` int UNIQUE)' ,
486
+ string : 'CREATE TABLE `post` (`id` int UNIQUE)'
487
+ } ,
488
+ mssql : {
489
+ text : 'CREATE TABLE [post] ([id] int UNIQUE)' ,
490
+ string : 'CREATE TABLE [post] ([id] int UNIQUE)'
491
+ } ,
492
+ oracle : {
493
+ text : 'CREATE TABLE "post" ("id" int UNIQUE)' ,
494
+ string : 'CREATE TABLE "post" ("id" int UNIQUE)'
495
+ } ,
496
+ params : [ ]
497
+ } ) ;
498
+
499
+ Harness . test ( {
500
+ query : Table . define ( {
501
+ name : 'post' ,
502
+ columns : [ {
503
+ name : 'id' ,
504
+ dataType : 'int' ,
505
+ //primaryKey: true,
506
+ notNull : true ,
507
+ unique : true
508
+ } ]
509
+ } ) . create ( ) ,
510
+ pg : {
511
+ text : 'CREATE TABLE "post" ("id" int NOT NULL UNIQUE)' ,
512
+ string : 'CREATE TABLE "post" ("id" int NOT NULL UNIQUE)'
513
+ } ,
514
+ sqlite : {
515
+ text : 'CREATE TABLE "post" ("id" int NOT NULL UNIQUE)' ,
516
+ string : 'CREATE TABLE "post" ("id" int NOT NULL UNIQUE)'
517
+ } ,
518
+ mysql : {
519
+ text : 'CREATE TABLE `post` (`id` int NOT NULL UNIQUE)' ,
520
+ string : 'CREATE TABLE `post` (`id` int NOT NULL UNIQUE)'
521
+ } ,
522
+ mssql : {
523
+ text : 'CREATE TABLE [post] ([id] int NOT NULL UNIQUE)' ,
524
+ string : 'CREATE TABLE [post] ([id] int NOT NULL UNIQUE)'
525
+ } ,
526
+ oracle : {
527
+ text : 'CREATE TABLE "post" ("id" int NOT NULL UNIQUE)' ,
528
+ string : 'CREATE TABLE "post" ("id" int NOT NULL UNIQUE)'
529
+ } ,
530
+ params : [ ]
531
+ } ) ;
532
+
533
+ Harness . test ( {
534
+ query : Table . define ( {
535
+ name : 'post' ,
536
+ columns : [ {
537
+ name : 'id' ,
538
+ dataType : 'int' ,
539
+ primaryKey : true ,
540
+ //notNull: true,
541
+ unique : true
542
+ } ]
543
+ } ) . create ( ) ,
544
+ pg : {
545
+ text : 'CREATE TABLE "post" ("id" int PRIMARY KEY)' ,
546
+ string : 'CREATE TABLE "post" ("id" int PRIMARY KEY)'
547
+ } ,
548
+ sqlite : {
549
+ text : 'CREATE TABLE "post" ("id" int PRIMARY KEY)' ,
550
+ string : 'CREATE TABLE "post" ("id" int PRIMARY KEY)'
551
+ } ,
552
+ mysql : {
553
+ text : 'CREATE TABLE `post` (`id` int PRIMARY KEY)' ,
554
+ string : 'CREATE TABLE `post` (`id` int PRIMARY KEY)'
555
+ } ,
556
+ mssql : {
557
+ text : 'CREATE TABLE [post] ([id] int PRIMARY KEY)' ,
558
+ string : 'CREATE TABLE [post] ([id] int PRIMARY KEY)'
559
+ } ,
560
+ oracle : {
561
+ text : 'CREATE TABLE "post" ("id" int PRIMARY KEY)' ,
562
+ string : 'CREATE TABLE "post" ("id" int PRIMARY KEY)'
563
+ } ,
564
+ params : [ ]
565
+ } ) ;
0 commit comments