drop namespace as of

This commit is contained in:
jackfoxy 2023-12-10 15:26:56 -08:00
parent 9bba6b1fed
commit e45db9c9ec
3 changed files with 233 additions and 73 deletions

View File

@ -146,7 +146,7 @@
=/ command-nail u.+3:q.+3:(parse-command [[1 1] script])
?- `urql-command`p.command-nail
%alter-index
~| "alter index error: {<(scag 100 q.q.command-nail)>} ..."
~| "alter index error: {<`tape`(scag 100 q.q.command-nail)>} ..."
=/ index-nail (parse-alter-index [[1 1] q.q.command-nail])
=/ parsed (wonk index-nail)
?: ?=([[@ @ @ @ @] [@ @ @ @ @] @] [parsed]) ::"alter index action"
@ -179,7 +179,7 @@
==
~|("Cannot parse alter-index {<p.q.command-nail>}" !!)
%alter-namespace
~| "alter namespace error: {<(scag 100 q.q.command-nail)>} ..."
~| "alter namespace error: {<`tape`(scag 100 q.q.command-nail)>} ..."
=/ namespace-nail (parse-alter-namespace [[1 1] q.q.command-nail])
=/ parsed (wonk namespace-nail)
%= $
@ -189,7 +189,7 @@
[`command:ast`(alter-namespace:ast %alter-namespace -<.parsed ->.parsed +<.parsed +>+>+<.parsed +>+>+>.parsed ~) commands]
==
%alter-table
~| "alter table error: {<(scag 100 q.q.command-nail)>} ..."
~| "alter table error: {<`tape`(scag 100 q.q.command-nail)>} ..."
=/ table-nail (parse-alter-table [[1 1] q.q.command-nail])
=/ parsed (wonk table-nail)
?: =(+<.parsed %alter-column)
@ -260,7 +260,7 @@
==
!!
%create-index
~| "create index error: {<(scag 100 q.q.command-nail)>} ..."
~| "create index error: {<`tape`(scag 100 q.q.command-nail)>} ..."
=/ index-nail (parse-create-index [[1 1] q.q.command-nail])
=/ parsed (wonk index-nail)
?: ?=([@ [* *]] [parsed]) ::"create index ..."
@ -352,7 +352,7 @@
[`command:ast`(create-namespace:ast %create-namespace -.id +.id [~ (as-of-offset:ast %as-of-offset -.asof +<.asof)]) commands]
==
%create-table
~| "create table error: {<(scag 100 q.q.command-nail)>} ..."
~| "create table error: {<`tape`(scag 100 q.q.command-nail)>} ..."
=/ table-nail (parse-create-table [[1 1] q.q.command-nail])
=/ parsed (wonk table-nail)
?: ?=([* * [@ @ *]] parsed)
@ -412,10 +412,10 @@
[`command:ast`(create-table:ast %create-table -.parsed +<.parsed +>->-.parsed +>->+.parsed (build-foreign-keys [-.parsed +>+.parsed]) ~) commands]
==
%create-view
~| "create view error: {<(scag 100 q.q.command-nail)>} ..."
~| "create view error: {<`tape`(scag 100 q.q.command-nail)>} ..."
!!
%delete
~| "delete error: {<(scag 100 q.q.command-nail)>} ..."
~| "delete error: {<`tape`(scag 100 q.q.command-nail)>} ..."
=/ delete-nail (parse-delete [[1 1] q.q.command-nail])
=/ parsed (wonk delete-nail)
%= $
@ -425,7 +425,7 @@
[`command:ast`(transform:ast %transform ~ [(produce-delete parsed) ~ ~]) commands]
==
%drop-database
~| "drop database error: {<(scag 100 q.q.command-nail)>} ..."
~| "drop database error: {<`tape`(scag 100 q.q.command-nail)>} ..."
=/ drop-database-nail (parse-drop-database [[1 1] q.q.command-nail])
=/ parsed (wonk drop-database-nail)
?@ parsed :: name
@ -443,7 +443,7 @@
==
!!
%drop-index
~| "drop index error: {<(scag 100 q.q.command-nail)>} ..."
~| "drop index error: {<`tape`(scag 100 q.q.command-nail)>} ..."
=/ drop-index-nail (parse-drop-index [[1 1] q.q.command-nail])
=/ parsed (wonk drop-index-nail)
%= $
@ -452,37 +452,80 @@
commands [`command:ast`(drop-index:ast %drop-index -.parsed +.parsed) commands]
==
%drop-namespace
~| "drop namespace error: {<(scag 100 q.q.command-nail)>} ..."
~| "drop namespace error: {<`tape`(scag 100 q.q.command-nail)>} ..."
=/ drop-namespace-nail (parse-drop-namespace [[1 1] q.q.command-nail])
=/ parsed (wonk drop-namespace-nail)
?@ parsed :: name
%= $
script q.q.u.+3.q:drop-namespace-nail
displacement (sub script-length (lent script))
commands [`command:ast`(drop-namespace:ast %drop-namespace default-database parsed %.n ~) commands]
script q.q.u.+3.q:drop-namespace-nail
displacement (sub script-length (lent script))
commands [`command:ast`(drop-namespace:ast %drop-namespace default-database parsed %.n ~) commands]
==
?: ?=([@ @] parsed) :: force name
?: =(%force -.parsed)
%= $
script q.q.u.+3.q:drop-namespace-nail
displacement (sub script-length (lent script))
commands [`command:ast`(drop-namespace:ast %drop-namespace default-database +.parsed %.y ~) commands]
==
%= $ :: db.name
script q.q.u.+3.q:drop-namespace-nail
displacement (sub script-length (lent script))
commands [`command:ast`(drop-namespace:ast %drop-namespace -.parsed +.parsed %.n ~) commands]
==
~| "Cannot parse drop-namespace {<parsed>}"
?: ?=([* [@ @]] parsed) :: force db.name
?: ?=([@ %as-of *] parsed) :: name as of
%= $
script q.q.u.+3.q:drop-namespace-nail
displacement (sub script-length (lent script))
commands [`command:ast`(drop-namespace:ast %drop-namespace +<.parsed +>.parsed %.y ~) commands]
script q.q.u.+3.q:drop-namespace-nail
displacement (sub script-length (lent script))
commands
?: =(%now +>.parsed)
[`command:ast`(drop-namespace:ast %drop-namespace default-database -.parsed %.n ~) commands]
?: ?=([@ @] +>.parsed)
[`command:ast`(drop-namespace:ast %drop-namespace default-database -.parsed %.n [~ +>+.parsed]) commands]
[`command:ast`(drop-namespace:ast %drop-namespace default-database -.parsed %.n [~ (as-of-offset:ast %as-of-offset +>-.parsed +>+<.parsed)]) commands]
==
?: ?=([[%force @] %as-of *] parsed) :: force name as of
%= $
script q.q.u.+3.q:drop-namespace-nail
displacement (sub script-length (lent script))
commands
?: =(%now +>.parsed)
[`command:ast`(drop-namespace:ast %drop-namespace default-database ->.parsed %.y ~) commands]
?: ?=([@ @] +>.parsed)
[`command:ast`(drop-namespace:ast %drop-namespace default-database ->.parsed %.y [~ +>+.parsed]) commands]
[`command:ast`(drop-namespace:ast %drop-namespace default-database ->.parsed %.y [~ (as-of-offset:ast %as-of-offset +>-.parsed +>+<.parsed)]) commands]
==
?: ?=([[@ @] %as-of *] parsed) :: name as of
%= $
script q.q.u.+3.q:drop-namespace-nail
displacement (sub script-length (lent script))
commands
?: =(%now +>.parsed)
[`command:ast`(drop-namespace:ast %drop-namespace -<.parsed ->.parsed %.n ~) commands]
?: ?=([@ @] +>.parsed)
[`command:ast`(drop-namespace:ast %drop-namespace -<.parsed ->.parsed %.n [~ +>+.parsed]) commands]
[`command:ast`(drop-namespace:ast %drop-namespace -<.parsed ->.parsed %.n [~ (as-of-offset:ast %as-of-offset +>-.parsed +>+<.parsed)]) commands]
==
?: ?=([[%force [@ @]] %as-of *] parsed) :: force db.name as of
%= $
script q.q.u.+3.q:drop-namespace-nail
displacement (sub script-length (lent script))
commands
?: =(%now +>.parsed)
[`command:ast`(drop-namespace:ast %drop-namespace ->-.parsed ->+.parsed %.y ~) commands]
?: ?=([@ @] +>.parsed)
[`command:ast`(drop-namespace:ast %drop-namespace ->-.parsed ->+.parsed %.y [~ +>+.parsed]) commands]
[`command:ast`(drop-namespace:ast %drop-namespace ->-.parsed ->+.parsed %.y [~ (as-of-offset:ast %as-of-offset +>-.parsed +>+<.parsed)]) commands]
==
?: ?=([%force @] parsed) :: force name
%= $
script q.q.u.+3.q:drop-namespace-nail
displacement (sub script-length (lent script))
commands [`command:ast`(drop-namespace:ast %drop-namespace default-database +.parsed %.y ~) commands]
==
?: ?=([@ @] parsed) :: db.name
%= $
script q.q.u.+3.q:drop-namespace-nail
displacement (sub script-length (lent script))
commands [`command:ast`(drop-namespace:ast %drop-namespace -.parsed +.parsed %.n ~) commands]
==
?: ?=([%force [@ @]] parsed) :: force db.name
%= $
script q.q.u.+3.q:drop-namespace-nail
displacement (sub script-length (lent script))
commands [`command:ast`(drop-namespace:ast %drop-namespace +<.parsed +>.parsed %.y ~) commands]
==
!!
%drop-table
~| "drop table error: {<(scag 100 q.q.command-nail)>} ..."
~| "drop table error: {<`tape`(scag 100 q.q.command-nail)>} ..."
=/ drop-table-nail (drop-table-or-view [[1 1] q.q.command-nail])
=/ parsed (wonk drop-table-nail)
?: ?=([@ @ @ @ @ @] parsed) :: force qualified table name
@ -501,7 +544,7 @@
==
~|("Cannot parse drop-table {<parsed>}" !!)
%drop-view
~| "drop view error: {<(scag 100 q.q.command-nail)>} ..."
~| "drop view error: {<`tape`(scag 100 q.q.command-nail)>} ..."
=/ drop-view-nail (drop-table-or-view [[1 1] q.q.command-nail])
=/ parsed (wonk drop-view-nail)
?: ?=([@ @ @ @ @ @] parsed) :: force qualified view
@ -520,7 +563,7 @@
==
~|("Cannot parse drop-view {<parsed>}" !!)
%grant
~| "grant error: {<(scag 100 q.q.command-nail)>} ..."
~| "grant error: {<`tape`(scag 100 q.q.command-nail)>} ..."
=/ grant-nail (parse-grant [[1 1] q.q.command-nail])
=/ parsed (wonk grant-nail)
?: ?=([@ [@ [@ %~]] [@ @]] [parsed]) ::"grant adminread to ~sampel-palnet on database db"
@ -553,7 +596,7 @@
==
~|("Cannot parse grant {<parsed>}" !!)
%insert
~| "insert error: {<(scag 100 q.q.command-nail)>} ..."
~| "insert error: {<`tape`(scag 100 q.q.command-nail)>} ..."
=/ insert-nail (parse-insert [[1 1] q.q.command-nail])
=/ parsed (wonk insert-nail)
%= $
@ -563,7 +606,7 @@
[`command:ast`(transform:ast %transform ~ [(produce-insert parsed) ~ ~]) commands]
==
%merge
~| "merge error: {<(scag 100 q.q.command-nail)>} ..."
~| "merge error: {<`tape`(scag 100 q.q.command-nail)>} ..."
=/ merge-nail (parse-merge [[1 1] q.q.command-nail])
=/ parsed (wonk merge-nail)
%= $
@ -573,7 +616,7 @@
[`command:ast`(transform:ast %transform ~ [(produce-merge parsed) ~ ~]) commands]
==
%query
~| "query error: {<(scag 100 q.q.command-nail)>} ..."
~| "query error: {<`tape`(scag 100 q.q.command-nail)>} ..."
=/ query-nail (parse-query [[1 1] q.q.command-nail])
=/ parsed (wonk query-nail)
%= $
@ -583,7 +626,7 @@
[`command:ast`(transform:ast %transform ~ [(produce-query parsed) ~ ~]) commands]
==
%revoke
~| "revoke error: {<(scag 100 q.q.command-nail)>} ..."
~| "revoke error: {<`tape`(scag 100 q.q.command-nail)>} ..."
=/ revoke-nail (parse-revoke [[1 1] q.q.command-nail])
=/ parsed (wonk revoke-nail)
?: ?=([@ [@ [@ %~]] [@ @]] [parsed]) ::"revoke adminread from ~sampel-palnet on database db"
@ -616,7 +659,7 @@
==
~|("Cannot parse revoke {<parsed>}" !!)
%truncate-table
~| "truncate table error: {<(scag 100 q.q.command-nail)>} ..."
~| "truncate table error: {<`tape`(scag 100 q.q.command-nail)>} ..."
=/ truncate-table-nail (parse-truncate-table [[1 1] q.q.command-nail])
%= $
script q.q.u.+3.q:truncate-table-nail
@ -625,7 +668,7 @@
[`command:ast`(truncate-table:ast %truncate-table (wonk truncate-table-nail)) commands]
==
%update
~| "update error: {<(scag 100 q.q.command-nail)>} ..."
~| "update error: {<`tape`(scag 100 q.q.command-nail)>} ..."
=/ update-nail (parse-update [[1 1] q.q.command-nail])
=/ parsed (wonk update-nail)
%= $
@ -635,7 +678,7 @@
[`command:ast`(transform:ast %transform ~ [(produce-update parsed) ~ ~]) commands]
==
%with
~| "with error: {<(scag 100 q.q.command-nail)>} ..."
~| "with error: {<`tape`(scag 100 q.q.command-nail)>} ..."
=/ with-nail (parse-with [[1 1] q.q.command-nail])
=/ parsed (wonk with-nail)
?: =(+<.parsed %delete)
@ -723,7 +766,7 @@
++ parse-create-namespace ;~ sfix
;~ pose
;~(plug parse-qualified-2-name parse-as-of)
parse-qualified-2-name
parse-qualified-2-name
==
end-or-next-command
==
@ -767,7 +810,10 @@
end-or-next-command
==
++ parse-drop-namespace ;~ sfix
;~(pose ;~(plug ;~(pfix whitespace (cold %force (jester 'force'))) parse-qualified-2-name) parse-qualified-2-name)
;~ pose
;~(plug ;~(pose ;~(plug ;~(pfix whitespace (cold %force (jester 'force'))) parse-qualified-2-name) parse-qualified-2-name) parse-as-of)
;~(pose ;~(plug ;~(pfix whitespace (cold %force (jester 'force'))) parse-qualified-2-name) parse-qualified-2-name)
==
end-or-next-command
==
++ drop-table-or-view ;~ sfix

View File

@ -3,37 +3,79 @@
|%
::
:: create table as of simple name as of now
++ test-create-table-08
=/ expected [%create-table table=[%qualified-object ship=~ database='db1' namespace='dbo' name='my-table'] columns=~[[%column name='col1' column-type=%t] [%column name='col2' column-type=%p] [%column name='col3' column-type=%ud]] clustered=%.y pri-indx=~[[%ordered-column name='col1' is-ascending=%.y] [%ordered-column name='col2' is-ascending=%.y]] foreign-keys=~ as-of=~]
=/ urql "create table my-table (col1 @t,col2 @p,col3 @ud) primary key (col1,col2) as of now"
:: name, as of now
++ test-drop-namespace-03
%+ expect-eq
!> ~[expected]
!> (parse:parse(default-database 'db1') urql)
!> ~[[%drop-namespace database-name='other-db' name='ns1' force=%.n as-of=~]]
!> (parse:parse(default-database 'other-db') "drop namespace ns1 as of now")
::
:: create table as of ns-qualified name as of datetime
++ test-create-table-09
=/ expected [%create-table table=[%qualified-object ship=~ database='db1' namespace='ns1' name='my-table'] columns=~[[%column name='col1' column-type=%t] [%column name='col2' column-type=%p] [%column name='col3' column-type=%ud]] clustered=%.y pri-indx=~[[%ordered-column name='col1' is-ascending=%.y] [%ordered-column name='col2' is-ascending=%.y]] foreign-keys=~ as-of=[~ ~2023.12.25..7.15.0..1ef5]]
=/ urql "create table ns1.my-table (col1 @t,col2 @p,col3 @ud) primary key (col1,col2) as of ~2023.12.25..7.15.0..1ef5"
:: name, as of date
++ test-drop-namespace-04
%+ expect-eq
!> ~[expected]
!> (parse:parse(default-database 'db1') urql)
!> ~[[%drop-namespace database-name='other-db' name='ns1' force=%.n as-of=[~ ~2023.12.25..7.15.0..1ef5]]]
!> (parse:parse(default-database 'other-db') "drop namespace ns1 as of ~2023.12.25..7.15.0..1ef5")
::
:: create table as of db-qualified name
++ test-create-table-10
=/ expected [%create-table table=[%qualified-object ship=~ database='db2' namespace='dbo' name='my-table'] columns=~[[%column name='col1' column-type=%t] [%column name='col2' column-type=%p] [%column name='col3' column-type=%ud]] clustered=%.y pri-indx=~[[%ordered-column name='col1' is-ascending=%.y] [%ordered-column name='col2' is-ascending=%.y]] foreign-keys=~ as-of=[~ [%as-of-offset 5 %seconds]]]
=/ urql "create table db2..my-table (col1 @t,col2 @p,col3 @ud) primary key (col1,col2) as of 5 seconds ago"
:: name, as of 5 seconds ago
++ test-drop-namespace-05
%+ expect-eq
!> ~[expected]
!> (parse:parse(default-database 'db1') urql)
!> ~[[%drop-namespace database-name='other-db' name='ns1' force=%.n as-of=[~ [%as-of-offset 5 %seconds]]]]
!> (parse:parse(default-database 'other-db') "drop namespace ns1 as of 5 seconds ago")
::
:: create table as of db-ns-qualified name
++ test-create-table-11
=/ expected [%create-table table=[%qualified-object ship=~ database='db2' namespace='ns1' name='my-table'] columns=~[[%column name='col1' column-type=%t] [%column name='col2' column-type=%p] [%column name='col3' column-type=%ud]] clustered=%.y pri-indx=~[[%ordered-column name='col1' is-ascending=%.y] [%ordered-column name='col2' is-ascending=%.y]] foreign-keys=~ as-of=[~ [%as-of-offset 15 %minutes]]]
=/ urql "create table db2.ns1.my-table (col1 @t,col2 @p,col3 @ud) primary key (col1,col2) as of 15 minutes ago"
:: force name as of now
++ test-drop-namespace-06
%+ expect-eq
!> ~[expected]
!> (parse:parse(default-database 'db1') urql)
!> ~[[%drop-namespace database-name='other-db' name='ns1' force=%.y as-of=~]]
!> (parse:parse(default-database 'other-db') "drop namespace force ns1 as of now")
::
:: force name as of date
++ test-drop-namespace-07
%+ expect-eq
!> ~[[%drop-namespace database-name='other-db' name='ns1' force=%.y as-of=[~ ~2023.12.25..7.15.0..1ef5]]]
!> (parse:parse(default-database 'other-db') "drop namespace force ns1 as of ~2023.12.25..7.15.0..1ef5")
::
:: force name as of 5 seconds ago
++ test-drop-namespace-08
%+ expect-eq
!> ~[[%drop-namespace database-name='other-db' name='ns1' force=%.y as-of=[~ [%as-of-offset 5 %seconds]]]]
!> (parse:parse(default-database 'other-db') "drop namespace force ns1 as of 5 seconds ago")
::
:: db name as of now
++ test-drop-namespace-09
%+ expect-eq
!> ~[[%drop-namespace database-name='db1' name='ns1' force=%.n as-of=~]]
!> (parse:parse(default-database 'other-db') "drop namespace db1.ns1 as of now")
::
:: db name as of date
++ test-drop-namespace-10
%+ expect-eq
!> ~[[%drop-namespace database-name='db1' name='ns1' force=%.n as-of=[~ ~2023.12.25..7.15.0..1ef5]]]
!> (parse:parse(default-database 'other-db') "drop namespace db1.ns1 as of ~2023.12.25..7.15.0..1ef5")
::
:: db name as of 5 seconds ago
++ test-drop-namespace-11
%+ expect-eq
!> ~[[%drop-namespace database-name='db1' name='ns1' force=%.n as-of=[~ [%as-of-offset 5 %seconds]]]]
!> (parse:parse(default-database 'other-db') "drop namespace db1.ns1 as of 5 seconds ago")
::
:: force db name as of
++ test-drop-namespace-12
%+ expect-eq
!> ~[[%drop-namespace database-name='db1' name='ns1' force=%.y as-of=~]]
!> (parse:parse(default-database 'other-db') "drop namespace force db1.ns1 as of now")
::
:: force db name as of
++ test-drop-namespace-13
%+ expect-eq
!> ~[[%drop-namespace database-name='db1' name='ns1' force=%.y as-of=[~ ~2023.12.25..7.15.0..1ef5]]]
!> (parse:parse(default-database 'other-db') "drop namespace force db1.ns1 as of ~2023.12.25..7.15.0..1ef5")
::
:: force db name as of
++ test-drop-namespace-14
%+ expect-eq
!> ~[[%drop-namespace database-name='db1' name='ns1' force=%.y as-of=[~ [%as-of-offset 15 %minutes]]]]
!> (parse:parse(default-database 'other-db') "drop namespace force db1.ns1 as of 15 minutes ago")
::@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
::

View File

@ -669,7 +669,7 @@
:: drop namespace
::
:: tests 1, 2, 3, 5, and extra whitespace characters, force db.name, name
++ test-drop-namespace-1
++ test-drop-namespace-00
=/ expected1 [%drop-namespace database-name='db' name='name' force=%.n as-of=~]
=/ expected2 [%drop-namespace database-name='other-db' name='name' force=%.y as-of=~]
%+ expect-eq
@ -677,24 +677,96 @@
!> (parse:parse(default-database 'other-db') "droP Namespace db.name;droP \0d\09 Namespace FORce \0a name")
::
:: leading and trailing whitespace characters, end delimiter not required on single, force name
++ test-drop-namespace-2
++ test-drop-namespace-01
%+ expect-eq
!> ~[[%drop-namespace database-name='other-db' name='name' force=%.y as-of=~]]
!> (parse:parse(default-database 'other-db') " \09drOp\0d\09 naMespace\0a force name ")
::
:: db.name
++ test-drop-namespace-3
::
:: db.name
++ test-drop-namespace-02
%+ expect-eq
!> ~[[%drop-namespace database-name='db' name='name' force=%.n as-of=~]]
!> (parse:parse(default-database 'other-db') "drop namespace db.name")
::
:: name, as of now
++ test-drop-namespace-03
%+ expect-eq
!> ~[[%drop-namespace database-name='other-db' name='ns1' force=%.n as-of=~]]
!> (parse:parse(default-database 'other-db') "drop namespace ns1 as of now")
::
:: name, as of date
++ test-drop-namespace-04
%+ expect-eq
!> ~[[%drop-namespace database-name='other-db' name='ns1' force=%.n as-of=[~ ~2023.12.25..7.15.0..1ef5]]]
!> (parse:parse(default-database 'other-db') "drop namespace ns1 as of ~2023.12.25..7.15.0..1ef5")
::
:: name, as of 5 seconds ago
++ test-drop-namespace-05
%+ expect-eq
!> ~[[%drop-namespace database-name='other-db' name='ns1' force=%.n as-of=[~ [%as-of-offset 5 %seconds]]]]
!> (parse:parse(default-database 'other-db') "drop namespace ns1 as of 5 seconds ago")
::
:: force name as of now
++ test-drop-namespace-06
%+ expect-eq
!> ~[[%drop-namespace database-name='other-db' name='ns1' force=%.y as-of=~]]
!> (parse:parse(default-database 'other-db') "drop namespace force ns1 as of now")
::
:: force name as of date
++ test-drop-namespace-07
%+ expect-eq
!> ~[[%drop-namespace database-name='other-db' name='ns1' force=%.y as-of=[~ ~2023.12.25..7.15.0..1ef5]]]
!> (parse:parse(default-database 'other-db') "drop namespace force ns1 as of ~2023.12.25..7.15.0..1ef5")
::
:: force name as of 5 seconds ago
++ test-drop-namespace-08
%+ expect-eq
!> ~[[%drop-namespace database-name='other-db' name='ns1' force=%.y as-of=[~ [%as-of-offset 5 %seconds]]]]
!> (parse:parse(default-database 'other-db') "drop namespace force ns1 as of 5 seconds ago")
::
:: db name as of now
++ test-drop-namespace-09
%+ expect-eq
!> ~[[%drop-namespace database-name='db1' name='ns1' force=%.n as-of=~]]
!> (parse:parse(default-database 'other-db') "drop namespace db1.ns1 as of now")
::
:: db name as of date
++ test-drop-namespace-10
%+ expect-eq
!> ~[[%drop-namespace database-name='db1' name='ns1' force=%.n as-of=[~ ~2023.12.25..7.15.0..1ef5]]]
!> (parse:parse(default-database 'other-db') "drop namespace db1.ns1 as of ~2023.12.25..7.15.0..1ef5")
::
:: db name as of 5 seconds ago
++ test-drop-namespace-11
%+ expect-eq
!> ~[[%drop-namespace database-name='db1' name='ns1' force=%.n as-of=[~ [%as-of-offset 5 %seconds]]]]
!> (parse:parse(default-database 'other-db') "drop namespace db1.ns1 as of 5 seconds ago")
::
:: force db name as of
++ test-drop-namespace-12
%+ expect-eq
!> ~[[%drop-namespace database-name='db1' name='ns1' force=%.y as-of=~]]
!> (parse:parse(default-database 'other-db') "drop namespace force db1.ns1 as of now")
::
:: force db name as of
++ test-drop-namespace-13
%+ expect-eq
!> ~[[%drop-namespace database-name='db1' name='ns1' force=%.y as-of=[~ ~2023.12.25..7.15.0..1ef5]]]
!> (parse:parse(default-database 'other-db') "drop namespace force db1.ns1 as of ~2023.12.25..7.15.0..1ef5")
::
:: force db name as of
++ test-drop-namespace-14
%+ expect-eq
!> ~[[%drop-namespace database-name='db1' name='ns1' force=%.y as-of=[~ [%as-of-offset 15 %minutes]]]]
!> (parse:parse(default-database 'other-db') "drop namespace force db1.ns1 as of 15 minutes ago")
::
:: fail when database qualifier is not a term
++ test-fail-drop-namespace-4
++ test-fail-drop-namespace-15
%- expect-fail
|. (parse:parse(default-database 'other-db') "DROP NAMESPACE Db.name")
::
:: fail when namespace is not a term
++ test-fail-drop-namespace-5
++ test-fail-drop-namespace-16
%- expect-fail
|. (parse:parse(default-database 'other-db') "DROP NAMESPACE nAme")
::