Skip to content

Commit

Permalink
Merge branch 'series/0.6.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
mpilquist committed Oct 27, 2023
2 parents 53b79c2 + 314a319 commit 6cd0a53
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions modules/core/shared/src/main/scala/data/Completion.scala
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ object Completion {
case object Explain extends Completion
case object Grant extends Completion
case object Revoke extends Completion
case object AlterIndex extends Completion
// more ...

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ object CommandComplete {
case "EXPLAIN" => apply(Completion.Explain)
case "GRANT" => apply(Completion.Grant)
case "REVOKE" => apply(Completion.Revoke)
case "ALTER INDEX" => apply(Completion.AlterIndex)
// more .. fill in as we hit them

case s => apply(Completion.Unknown(s))
Expand Down
15 changes: 11 additions & 4 deletions modules/tests/shared/src/test/scala/CommandTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,14 @@ class CommandTest extends SkunkTest {
)
""".command

val alterIndex: Command[Void] =
sql"""
ALTER INDEX IF EXISTS id_index RENAME TO pk_index
""".command

val dropIndex: Command[Void] =
sql"""
DROP INDEX id_index
DROP INDEX pk_index
""".command

val createView: Command[Void] =
Expand Down Expand Up @@ -329,16 +334,18 @@ class CommandTest extends SkunkTest {
FROM skunk_role
""".command

sessionTest("create table, create index, drop index, alter table and drop table") { s =>
sessionTest("create table, create index, alter table, alter index, drop index and drop table") { s =>
for {
c <- s.execute(createTable)
_ <- assert("completion", c == Completion.CreateTable)
c <- s.execute(createIndex)
_ <- assert("completion", c == Completion.CreateIndex)
c <- s.execute(dropIndex)
_ <- assert("completion", c == Completion.DropIndex)
c <- s.execute(alterTable)
_ <- assert("completion", c == Completion.AlterTable)
c <- s.execute(alterIndex)
_ <- assert("completion", c == Completion.AlterIndex)
c <- s.execute(dropIndex)
_ <- assert("completion", c == Completion.DropIndex)
c <- s.execute(dropTable)
_ <- assert("completion", c == Completion.DropTable)
_ <- s.assertHealthy
Expand Down

0 comments on commit 6cd0a53

Please sign in to comment.