@@ -436,7 +436,11 @@ describe('#integration-rx summary', () => {
436
436
return
437
437
}
438
438
439
- await verifyUpdates ( runnable , 'CREATE INDEX on :Label(prop)' , null , {
439
+ const query = isNewConstraintIndexSyntax ( protocolVersion )
440
+ ? 'CREATE INDEX FOR (l:Label) ON (l.prop)'
441
+ : 'CREATE INDEX ON :Label(prop)'
442
+
443
+ await verifyUpdates ( runnable , query , null , {
440
444
nodesCreated : 0 ,
441
445
nodesDeleted : 0 ,
442
446
relationshipsCreated : 0 ,
@@ -467,12 +471,18 @@ describe('#integration-rx summary', () => {
467
471
// first create the to-be-dropped index
468
472
const session = driver . session ( )
469
473
try {
470
- await session . run ( 'CREATE INDEX on :Label(prop)' )
474
+ const query = isNewConstraintIndexSyntax ( protocolVersion )
475
+ ? 'CREATE INDEX l_prop FOR (l:Label) ON (l.prop)'
476
+ : 'CREATE INDEX ON :Label(prop)'
477
+ await session . run ( query )
471
478
} finally {
472
479
await session . close ( )
473
480
}
474
481
475
- await verifyUpdates ( runnable , 'DROP INDEX on :Label(prop)' , null , {
482
+ const query = isNewConstraintIndexSyntax ( protocolVersion )
483
+ ? 'DROP INDEX l_prop'
484
+ : 'DROP INDEX ON :Label(prop)'
485
+ await verifyUpdates ( runnable , query , null , {
476
486
nodesCreated : 0 ,
477
487
nodesDeleted : 0 ,
478
488
relationshipsCreated : 0 ,
@@ -499,24 +509,22 @@ describe('#integration-rx summary', () => {
499
509
return
500
510
}
501
511
502
- await verifyUpdates (
503
- runnable ,
504
- 'CREATE CONSTRAINT ON (book:Book) ASSERT book.isbn IS UNIQUE' ,
505
- null ,
506
- {
507
- nodesCreated : 0 ,
508
- nodesDeleted : 0 ,
509
- relationshipsCreated : 0 ,
510
- relationshipsDeleted : 0 ,
511
- propertiesSet : 0 ,
512
- labelsAdded : 0 ,
513
- labelsRemoved : 0 ,
514
- indexesAdded : 0 ,
515
- indexesRemoved : 0 ,
516
- constraintsAdded : 1 ,
517
- constraintsRemoved : 0
518
- }
519
- )
512
+ const query = isNewConstraintIndexSyntax ( protocolVersion )
513
+ ? 'CREATE CONSTRAINT FOR (book:Book) REQUIRE book.isbn IS UNIQUE'
514
+ : 'CREATE CONSTRAINT ON (book:Book) ASSERT book.isbn IS UNIQUE'
515
+ await verifyUpdates ( runnable , query , null , {
516
+ nodesCreated : 0 ,
517
+ nodesDeleted : 0 ,
518
+ relationshipsCreated : 0 ,
519
+ relationshipsDeleted : 0 ,
520
+ propertiesSet : 0 ,
521
+ labelsAdded : 0 ,
522
+ labelsRemoved : 0 ,
523
+ indexesAdded : 0 ,
524
+ indexesRemoved : 0 ,
525
+ constraintsAdded : 1 ,
526
+ constraintsRemoved : 0
527
+ } )
520
528
}
521
529
522
530
/**
@@ -535,31 +543,30 @@ describe('#integration-rx summary', () => {
535
543
// first create the to-be-dropped index
536
544
const session = driver . session ( )
537
545
try {
538
- await session . run (
539
- 'CREATE CONSTRAINT ON (book:Book) ASSERT book.isbn IS UNIQUE'
540
- )
546
+ const query = isNewConstraintIndexSyntax ( protocolVersion )
547
+ ? 'CREATE CONSTRAINT book_isbn FOR (book:Book) REQUIRE book.isbn IS UNIQUE'
548
+ : 'CREATE CONSTRAINT ON (book:Book) ASSERT book.isbn IS UNIQUE'
549
+ await session . run ( query )
541
550
} finally {
542
551
await session . close ( )
543
552
}
544
553
545
- await verifyUpdates (
546
- runnable ,
547
- 'DROP CONSTRAINT ON (book:Book) ASSERT book.isbn IS UNIQUE' ,
548
- null ,
549
- {
550
- nodesCreated : 0 ,
551
- nodesDeleted : 0 ,
552
- relationshipsCreated : 0 ,
553
- relationshipsDeleted : 0 ,
554
- propertiesSet : 0 ,
555
- labelsAdded : 0 ,
556
- labelsRemoved : 0 ,
557
- indexesAdded : 0 ,
558
- indexesRemoved : 0 ,
559
- constraintsAdded : 0 ,
560
- constraintsRemoved : 1
561
- }
562
- )
554
+ const query = isNewConstraintIndexSyntax ( protocolVersion )
555
+ ? 'DROP CONSTRAINT book_isbn'
556
+ : 'DROP CONSTRAINT ON (book:Book) ASSERT book.isbn IS UNIQUE'
557
+ await verifyUpdates ( runnable , query , null , {
558
+ nodesCreated : 0 ,
559
+ nodesDeleted : 0 ,
560
+ relationshipsCreated : 0 ,
561
+ relationshipsDeleted : 0 ,
562
+ propertiesSet : 0 ,
563
+ labelsAdded : 0 ,
564
+ labelsRemoved : 0 ,
565
+ indexesAdded : 0 ,
566
+ indexesRemoved : 0 ,
567
+ constraintsAdded : 0 ,
568
+ constraintsRemoved : 1
569
+ } )
563
570
}
564
571
565
572
/**
@@ -764,4 +771,8 @@ describe('#integration-rx summary', () => {
764
771
await session . close ( )
765
772
}
766
773
}
774
+
775
+ function isNewConstraintIndexSyntax ( protocolVersion ) {
776
+ return protocolVersion > 4.3
777
+ }
767
778
} )
0 commit comments