@@ -242,6 +242,9 @@ class CommandTest extends SkunkTest {
242
242
CREATE ROLE skunk_role
243
243
""" .command
244
244
245
+ val alterRole : Command [Void ] =
246
+ sql " ALTER ROLE skunk_role WITH PASSWORD '123' " .command
247
+
245
248
val dropRole : Command [Void ] =
246
249
sql """
247
250
DROP ROLE skunk_role
@@ -295,6 +298,11 @@ class CommandTest extends SkunkTest {
295
298
END;'
296
299
""" .command
297
300
301
+ val alterFunction : Command [Void ] =
302
+ sql """
303
+ ALTER FUNCTION my_trigger_func() RESET search_path
304
+ """ .command
305
+
298
306
val dropFunction : Command [Void ] =
299
307
sql " DROP FUNCTION my_trigger_func; " .command
300
308
@@ -331,6 +339,35 @@ class CommandTest extends SkunkTest {
331
339
FROM skunk_role
332
340
""" .command
333
341
342
+ val addComment : Command [Void ] =
343
+ sql " COMMENT ON TABLE city IS 'A city' " .command
344
+
345
+ val removeComment : Command [Void ] =
346
+ sql " COMMENT ON TABLE city IS NULL " .command
347
+
348
+ val createPolicy : Command [Void ] =
349
+ sql """
350
+ CREATE POLICY my_policy ON city
351
+ TO CURRENT_USER
352
+ WITH CHECK (FALSE)
353
+ """ .command
354
+
355
+ val alterPolicy : Command [Void ] =
356
+ sql """
357
+ ALTER POLICY my_policy
358
+ ON city TO CURRENT_USER
359
+ WITH CHECK (TRUE)
360
+ """ .command
361
+
362
+ val dropPolicy : Command [Void ] =
363
+ sql " DROP POLICY my_policy ON city " .command
364
+
365
+ val analyze : Command [Void ] =
366
+ sql " ANALYZE city " .command
367
+
368
+ val analyzeVerbose : Command [Void ] =
369
+ sql " ANALYZE VERBOSE city " .command
370
+
334
371
sessionTest(" create table, create index, alter table, alter index, drop index and drop table" ) { s =>
335
372
for {
336
373
c <- s.execute(createTable)
@@ -359,6 +396,8 @@ class CommandTest extends SkunkTest {
359
396
_ <- assert(" completion" , c == Completion .AlterTrigger )
360
397
c <- s.execute(dropTrigger)
361
398
_ <- assert(" completion" , c == Completion .DropTrigger )
399
+ c <- s.execute(alterFunction)
400
+ _ <- assert(" completion" , c == Completion .AlterFunction )
362
401
c <- s.execute(dropFunction)
363
402
_ <- assert(" completion" , c == Completion .DropFunction )
364
403
_ <- s.assertHealthy
@@ -387,6 +426,18 @@ class CommandTest extends SkunkTest {
387
426
} yield " ok"
388
427
}
389
428
429
+ sessionTest(" create, alter and drop policy" ) { s =>
430
+ for {
431
+ c <- s.execute(createPolicy)
432
+ _ <- assert(" completion" , c == Completion .CreatePolicy )
433
+ c <- s.execute(alterPolicy)
434
+ _ <- assert(" completion" , c == Completion .AlterPolicy )
435
+ c <- s.execute(dropPolicy)
436
+ _ <- assert(" completion" , c == Completion .DropPolicy )
437
+ _ <- s.assertHealthy
438
+ } yield " ok"
439
+ }
440
+
390
441
sessionTest(" create view, drop view" ){ s=>
391
442
for {
392
443
c <- s.execute(createView)
@@ -458,10 +509,12 @@ class CommandTest extends SkunkTest {
458
509
} yield " ok"
459
510
}
460
511
461
- sessionTest(" create role, drop role" ) { s =>
512
+ sessionTest(" create role, alter role, drop role" ) { s =>
462
513
for {
463
514
c <- s.execute(createRole)
464
515
_ <- assert(" completion" , c == Completion .CreateRole )
516
+ c <- s.execute(alterRole)
517
+ _ <- assert(" completion" , c == Completion .AlterRole )
465
518
c <- s.execute(dropRole)
466
519
_ <- assert(" completion" , c == Completion .DropRole )
467
520
} yield " ok"
@@ -484,6 +537,26 @@ class CommandTest extends SkunkTest {
484
537
} yield " ok"
485
538
}
486
539
540
+ sessionTest(" add comment, remove comment" ) { s =>
541
+ for {
542
+ c <- s.execute(addComment)
543
+ _ <- assert(" completion" , c == Completion .Comment )
544
+ c <- s.execute(removeComment)
545
+ _ <- assert(" completion" , c == Completion .Comment )
546
+ _ <- s.assertHealthy
547
+ } yield " ok"
548
+ }
549
+
550
+ sessionTest(" analyze" ) { s =>
551
+ for {
552
+ c <- s.execute(analyze)
553
+ _ <- assert(" completion" , c == Completion .Analyze )
554
+ v <- s.execute(analyzeVerbose)
555
+ _ <- assert(" completion" , v == Completion .Analyze )
556
+ _ <- s.assertHealthy
557
+ } yield " ok"
558
+ }
559
+
487
560
sessionTest(" set constraints" ) { s =>
488
561
s.transaction.use { _ =>
489
562
for {
0 commit comments