doc progress

This commit is contained in:
jackfoxy 2023-05-22 14:08:37 -07:00
parent 83cdf09388
commit 8bc1197b32
7 changed files with 434 additions and 118 deletions

View File

@ -1,8 +1,10 @@
# CREATE DATABASE
Creates a new user-space database available to any agent running on the ship. There is no sand-boxing.
TO DO: consider adding an owner-desk property and GRANT desk permissions.
```
CREATE DATABASE <database-name>
CREATE DATABASE <database>
```
## Example
@ -18,7 +20,7 @@ CREATE DATABASE <database-name>
## Arguments
**`<database-name>`**
**`<database>`**
User-defined name for the new database. Must follow the hoon term naming standard.
## Remarks
@ -43,9 +45,9 @@ Creates an index over selected column(s) on an existing table.
```
<create-index> ::=
CREATE [ UNIQUE ] [ NONCLUSTERED | CLUSTERED ] INDEX <index-name>
ON [ <db-qualifer> ] <table-name>
( <column-name> [ ASC | DESC ] [ ,...n ] )
CREATE [ UNIQUE ] [ NONCLUSTERED | CLUSTERED ] INDEX <index>
ON [ <db-qualifer> ] <table>
( <column> [ ASC | DESC ] [ ,...n ] )
```
## Examples
@ -72,14 +74,14 @@ CREATE INDEX ix_vendor-id3 ON purchasing..product-vendor (vendor-id);
## Arguments
**`<index-name>`**
**`<index>`**
User-defined name for the new index. Must follow the hoon term naming standard.
**`<table-name>`**
**`<table>`**
Name of existing table the index targets.
If not explicitly qualified defaults to the agent's current database and 'dbo' namespace.
If not explicitly qualified defaults to the Obelisk agent's current database and 'dbo' namespace.
**`<column-name> [ ASC | DESC ] [ ,...n ] `**
**`<column> [ ASC | DESC ] [ ,...n ] `**
List of column names in the target table, representing the sort hierarchy, and optionally sort direction for each level, defaulting to `ASC`, ascending.
## Remarks
@ -108,7 +110,7 @@ When not otherwise specified namepace designations default to `dbo`.
```
<create-namespace> ::=
CREATE NAMESPACE [<database-name>.]<namespace-name>
CREATE NAMESPACE [<database>.]<namespace>
```
## Example
@ -121,7 +123,7 @@ When not otherwise specified namepace designations default to `dbo`.
## Arguments
**`<namespace-name>`**
**`<namespace>`**
User-defined name for the new index. Must follow the hoon term naming standard.
The namespace "sys" is reserved for system use.
@ -142,8 +144,8 @@ Procedures are urQL scripts that accept parameters.
```
<create-proc> ::=
CREATE { PROC | PROCEDURE }
[<db-qualifer>]<procedure-name>
[ { #<parameter-name> <data-type> } ] [ ,...n ]
[<db-qualifer>]<procedure>
[ { #<parameter> <data-type> } ] [ ,...n ]
AS { <urql command>; | *hoon } [ ;...n ]
```
@ -154,18 +156,18 @@ Cannot be used to create database.
# CREATE TABLE
Tables are the only means of indexed persistent `<table-sets>`s.
Any update to `<table>` contents results in an agent state change.
Any update to `<table>` contents results the Obelisk agent changeing state.
TO DO: any reason to specify foreign key name (see CREATE INDEX).
```
<create-table> ::=
CREATE TABLE
[ <db-qualifer> ]<table-name>
( { <column-name> <aura> }
[ <db-qualifer> ]<table>
( { <column> <aura> }
[ ,... n ] )
PRIMARY KEY [ NONCLUSTERED | CLUSTERED ] ( <column-name> [ ,... n ] )
[ { FOREIGN KEY <foreign-key-name> ( <column-name> [ ASC | DESC ] [ ,... n ] )
REFERENCES [ <namespace-name>. ] <table-name> ( <column-name> [ ,... n ] )
PRIMARY KEY [ NONCLUSTERED | CLUSTERED ] ( <column> [ ,... n ] )
[ { FOREIGN KEY <foreign-key> ( <column> [ ASC | DESC ] [ ,... n ] )
REFERENCES [ <namespace>. ] <table> ( <column> [ ,... n ] )
[ ON DELETE { NO ACTION | CASCADE | SET DEFAULT } ]
[ ON UPDATE { NO ACTION | CASCADE | SET DEFAULT } ] }
[ ,... n ] ]`
@ -194,22 +196,22 @@ REFERENCES special-offer (product-id, special-offer-id)
## Arguments
**`<table-name>`**
**`<table>`**
User-defined name for the new table. Must follow the hoon term naming standard.
If not explicitly qualified defaults to the agent's current database and 'dbo' namespace.
If not explicitly qualified defaults to the Obelisk agent's current database and 'dbo' namespace.
**`<column-name> <aura>`**
**`<column> <aura>`**
List of user-define column names and associated auras. Names must follow the hoon term naming standard.
See [ref-ch02-types](ref-ch02-types.md)
**`[ NONCLUSTERED | CLUSTERED ] ( <column-name> [ ,... n ]`**
**`[ NONCLUSTERED | CLUSTERED ] ( <column> [ ,... n ]`**
Columns in the required unique primary index. Defining the index as `CLUSTERED` is optional.
**`<foreign-key-name> ( <column-name> [ ASC | DESC ] [ ,... n ]`**
**`<foreign-key> ( <column> [ ASC | DESC ] [ ,... n ]`**
User-defined name for `<foreign-key>`. Must follow the hoon term naming standard.
List of columns in the table for association with a foreign table along with sort ordering. Default is `ASC` ascending.
**`<table-name> ( <column-name> [ ,... n ]`**
**`<table> ( <column> [ ,... n ]`**
Referenced foreign `<table>` and columns. Count and associated column auras must match the specified columns from the new `<table>`.
**`ON DELETE { NO ACTION | CASCADE | SET DEFAULT }`**
@ -217,7 +219,7 @@ Specifies an action on the rows in the table if those rows have a referential re
* NO ACTION (default)
The agent raises an error and the delete action on the row in the parent foreign table is rolled back.
The Obelisk agent raises an error and the delete action on the row in the parent foreign table is aborted.
* CASCADE
@ -226,14 +228,14 @@ Corresponding rows are deleted from the referencing table when that row is delet
* SET DEFAULT
All the values that make up the foreign key are set to their bunt values when the corresponding row in the parent foreign table is deleted.
The agent raises an error if the parent table has no entry with bunt values.
The Obelisk agent raises an error if the parent table has no entry with bunt values.
**`ON UPDATE { NO ACTION | CASCADE | SET DEFAULT }`**
Specifies an action on the rows in the table if those rows have a referential relationship and the referenced row is deleted from the foreign table.
* NO ACTION (default)
The Database Engine raises an error, and the update action on the row in the parent table is rolled back.
The Database Engine raises an error, and the update action on the row in the parent table is aborted.
* CASCADE
@ -242,7 +244,7 @@ Corresponding rows are updated in the referencing table when that row is updated
* SET DEFAULT
All the values that make up the foreign key are set to their bunt values when the corresponding row in the parent table is updated.
The agent raises an error if the parent table has no entry with bunt values.
The Obelisk agent raises an error if the parent table has no entry with bunt values.
## Remarks
The command results in a state change of the Obelisk agent.
@ -267,7 +269,7 @@ table column referenced by FOREIGN KEY does not exist
aura mis-match in FOREIGN KEY
# CREATE TRIGGER
A trigger automatically runs when a specified event occurs in the agent. It runs a previously defined `<procedure>`.
A trigger automatically runs when a specified table or view event occurs in the Obelisk agent. It runs a previously defined `<procedure>`.
An `INSTEAD OF` trigger fires before the triggering event can occur and replaces it. Otherwise the procedure runs after the triggering event succedes and all state changed by both the triggering event and trigger `<procedure>` is included in one and the same state change.
@ -276,8 +278,8 @@ The trigger event for a `<view>` is simple execution.
```
<create-trigger> ::=
CREATE TRIGGER [ <db-qualifer> ]<trigger-name>
ON { <table-name> | <view-name> }
CREATE TRIGGER [ <db-qualifer> ]<trigger>
ON { <table> | <view> }
{ AFTER | INSTEAD OF }
{ [ INSERT ] [ , ] [ UPDATE ] [ , ] [ DELETE ] }
AS <procedure>
@ -297,7 +299,7 @@ Potential caching of views is TBD.
```
<create-view> ::=
CREATE VIEW [ <db-qualifer> ]<view-name> AS <transform>
CREATE VIEW [ <db-qualifer> ]<view> AS <transform>
```
## API
@ -312,7 +314,7 @@ Potential caching of views is TBD.
## Arguments
**`<view-name>`**
**`<view>`**
User-defined name for the new view. Must follow the hoon term naming standard.
**`<transform>`**
@ -326,8 +328,8 @@ The last step of the `<transform>` must establish unique column names, whether i
## Produced Metadata
INSERT `name`, `<transform>`, `<timestamp>` into `sys.sys.views`
INSERT `name`, `<ordinal>`, `<column>` into `sys.sys.view-columns`
INSERT `name`, `<transform>`, `<timestamp>` into `<database>.sys.views`
INSERT `name`, `<ordinal>`, `<column>` into `<database>.sys.view-columns`
## Exceptions

View File

@ -24,16 +24,18 @@ Deletes rows from a `<table-set>`.
## Arguments
** **
**`<table-set>`**
Target of the `DELETE` operation.
**`<predicate>`**
Any valid `<predicate>` including predicates on CTEs.
## Remarks
The command potentially mutates `<table>` and if so results in a state change of the Obelisk agent.
A stand-alone `DELETE` statement can only operate on a `<table>` and produces a `<transform>` of one command step with no CTEs.
When `<table-set>` is a `<table>` the command potentially mutates `<table>` and if so results in a state change of the Obelisk agent.
A stand-alone `DELETE` statement can only operate on a `<table>` and produces a `<transform>` of one command step.
Data in the namespace *sys* cannot be deleted.
When `<table-set>` is a virtual table the command produces an output `<table-set>` which may be consumed as a pass-thru by a subsequent `<transform>` step.
@ -83,16 +85,27 @@ Inserts rows into a `<table-set>`.
## Arguments
** **
**`<table-set>`**
Target of the `INSERT` operation.
**`<column>` [ ,...n ]**
When present the column list must account for all column identifiers (names or aliases) in the target once.
Establishes the order in which update values are applied and the output `<table-set>`'s column order.
**(`<scalar-expression>` [ ,...n ] ) [ ,...n ]**
Row(s) of literal values to insert into target.
Auras must match target columnwise.
**`<transform>`**
Transform creating source `<table-set>` to insert into target.
Source auras must match target columnwise.
## Remarks
The command potentially mutates `<table>` and if so results in a state change of the Obelisk agent.
When `<table-set>` is a `<table>` the command potentially mutates `<table>` and if so results in a state change of the Obelisk agent.
A stand-alone `INSERT` statement can only operate on a `<table>` and produces a `<transform>` of one command step with no CTEs.
When `<table-set>` is a `<table>` the command potentially mutates `<table>` and if so results in a state change of the Obelisk agent.
Data in the namespace *sys* cannot be inserted into.
When `<table-set>` is a virtual table the command produces an output `<table-set>` which may be consumed as a pass-thru by a subsequent `<transform>` step.
@ -115,6 +128,7 @@ When target `<table-set>` is not a `<table>` and the input is from a `<transform
## Exceptions
`<table>` does not exist
`GRANT` permission on `<table>` violated
unique key violation
colum misalignment
@ -138,7 +152,8 @@ Removes all rows in a base table.
## Arguments
** **
**`<table>`**
Target table.
## Remarks
@ -160,8 +175,8 @@ none
Changes content of selected columns in existing rows of a `<table-set>`.
```
<truncate-table> ::=
UPDATE [ <ship-qualifer> ] <table>
<update> ::=
UPDATE [ <ship-qualifer> ] <table-set>
SET { <column> = <scalar-expression> } [ ,...n ]
[ WHERE <predicate> ]
```
@ -180,16 +195,22 @@ Changes content of selected columns in existing rows of a `<table-set>`.
## Arguments
** **
**`<table-set>`**
Target of the `UPDATE` operation
**`<column>` = `<scalar-expression>`**
`<column>` is a column name or alias of a target column.
`<scalar-expression>` valid expression within the statement context.
**`<predicate>`**
Any valid `<predicate>` including predicates on CTEs.
## Remarks
The command potentially mutates `<table>` and if so results in a state change of the Obelisk agent.
When `<table-set>` is a `<table>` the command potentially mutates `<table>` and if so results in a state change of the Obelisk agent.
A stand-alone `UPDATE` statement can only operate on a `<table>` and produces a `<transform>` of one command step with no CTEs.
When `<table-set>` is a `<table>` the command potentially mutates `<table>` and if so results in a state change of the Obelisk agent.
Data in the namespace *sys* cannot be updated.
When `<table-set>` is a virtual table the command produces an output `<table-set>` which may be consumed as a pass-thru by a subsequent `<transform>` step.
@ -206,3 +227,5 @@ Escape single quotes with double backslash thusly `'this is a cor\\'d'`.
## Exceptions
`<table>` does not exist
`GRANT` permission on `<table>` violated
unique key violation
aura mismatch on `SET`

View File

@ -9,7 +9,7 @@
[ ...n ]
| CROSS JOIN <table-set> [ [AS] <alias> ]
]
[ { SCALAR <scalar-name> [ AS ] <scalar-function> } [ ...n ] ]
[ { SCALAR <scalar> [ AS ] <scalar-function> } [ ...n ] ]
[ WHERE <predicate> ]
[ GROUP BY { <qualified-column> | <column-alias> | <column-ordinal> }
[ ,...n ]
@ -96,9 +96,9 @@ See CH 8 Functions for full documentation on Scalars.
<expression> ::=
{ <qualified-column>
| <constant>
| <scalar-name>
| <scalar>
| <scalar-query>
| <aggregate-function>( { <column> | <scalar-name> } )
| <aggregate-function>( { <column> | <scalar> } )
}
```
`<scalar-query>` is defined in a CTE and must return only one column. The first returned value is accepted and subsequent values ignored.
@ -117,7 +117,7 @@ See CH 8 Functions for full documentation on Scalars.
```
<qualified-column> ::=
[ [ <ship-qualifer> ]<table-view> | <alias> ].<column-name>
[ [ <ship-qualifer> ]<table-view> | <alias> ].<column>
```
## API

View File

@ -1,35 +1,146 @@
# GRANT
Grants permission to read from and/or write to selected `<database>` on host ship to selected foreign ships.
```
GRANT { ADMINREAD | READONLY | READWRITE }
TO { PARENT | SIBLINGS | MOONS | <@p> [ ,...n ] }
ON { DATABASE <database-name>
| NAMESPACE [<database-name>]<namespace-name>
| [<db-qualifer>]{<view-name> | <table-name> }
ON { DATABASE <database>
| NAMESPACE [<database>.]<namespace>
| [<db-qualifer>]<table-object>
}
```
## Example
`GRANT READONLY TO ~sampel-palnet ON my-namespace`
`GRANT READONLY TO ~sampel-palnet ON NAMESPACE my-namespace`
## API
```
$:
%grant
permission=grant-permission
to=grantee
grant-target=grant-object
==
```
## Arguments
** **
**ADMINREAD**
Grants read permission on `<database>.sys` tables and views.
`ON` clause must be `<database>`.
Discussion:
Grantees `PARENT` and `SIBLINGS` are only valid for moon servers. `MOONS` is only valid for moon parents.
`ADMINREAD` grants read-only access to the servers administration tables and views
**READONLY**
Grants read permission on selected object.
**READWRITE**
Grants read and write permission on selected object.
**PARENT**
Grantee is parent of ship on which Obelisk agent is running.
**SIBLINGS**
Grantees are all other moons of the parent of ship on which Obelisk agent is running.
**MOONS**
Grantees are all moons of the ship on which Obelisk agent is running.
**<@p> [ ,...n ]**
List of ships to grant permission to.
**`<database>`**
Grant permissin on named database to all `<table>s` and `<view>`s.
**`[<database>.]<namespace>`**
Grant permissin on named namespace to all `<table>s` and `<view>`s.
**`[<db-qualifer>]<table-object>`**
Grant permission is on named object, whether is is a `<table>` or `<view>`.
## Remarks
The command results in a state change of the Obelisk agent.
Write permission includes `DELETE`, `INSERT`, and `UPDATE`.
When a granted database object is dropped all applicable `GRANT`s are also dropped.
`<table-object>` remain valid whether a `<view>` is shadowing a `<table>` or not.
In the case where a shadowing `<view>` is dropped the grant then applies to the `<table>`.
In the case where a new `<view>` shadows a granted `<table>` the grant newly applies to the `<view>`.
## Produced Metadata
INSERT grantee, grant, target, `<timestamp>` INTO `<database>.sys.grants`
## Exceptions
`<database>` does not exist.
`<namespace>` does not exist.
`<table-object>` does not exist.
`GRANT` target type does not exist. (e.g. host is a `MOON` and `GRANT` is `ON MOONS`)
# REVOKE
Revokes permission to read from and/or write to selected database objects on host ship to selected foreign ships.
```
REVOKE { ADMINREAD | READONLY | READWRITE | ALL }
FROM { PARENT | SIBLINGS | MOONS | ALL | <@p> [ ,...n ] }
ON { DATABASE <database-name>
| NAMESPACE [<database-name>]<namespace-name>
| [<db-qualifer>]{<view-name> | <table-name> }
ON { DATABASE <database>
| NAMESPACE [<database>.]<namespace>
| [<db-qualifer>]<table-object>
}
```
## API
```
+$ revoke
$:
%revoke
permission=revoke-permission
from=revoke-from
revoke-target=revoke-object
==
```
## Arguments
** **
**ADMINREAD**
Revokes read permission on `<database>.sys` tables and views.
`ON` clause must be `<database>`.
**READONLY**
Revokes read permission on selected object.
**READWRITE**
Revokes read and write (DELETE, INSERT, UPDATE) permission on selected object.
**PARENT**
Grantee is parent of ship on which Obelisk agent is running.
**SIBLINGS**
Grantees are all other moons of the parent of ship on which Obelisk agent is running.
**MOONS**
Grantees are all moons of the ship on which Obelisk agent is running.
**<@p> [ ,...n ]**
List of ships to grant permission to.
**`<database>`**
Grant permissin on named database.
**`[<database>.]<namespace>`**
Revoke permissin on named namespace.
**`[<db-qualifer>]<table-object>`**
Revoke permission is on named object, whether is is a `<table>` or `<view>`.
## Remarks
The command results in a state change of the Obelisk agent.
## Produced Metadata
DROP grantee, grant, target FROM `<database>.sys.grants`
## Exceptions
`GRANT` does not exist.

View File

@ -1,40 +1,76 @@
# ALTER INDEX
Alters the structure of an existing `<index>`
```
ALTER INDEX [ <db-qualifer> ]{ <index-name> }
ON { <table-name> | <view-name> }
[ ( <column-name> [ ASC | DESC ] [ ,...n ] ) ]
{ REBUILD | DISABLE | RESUME}
ALTER [ UNIQUE ] [ NONCLUSTERED | CLUSTERED ] INDEX [ <db-qualifer> ]<index>
ON { <table> | <view> }
[ ( <column> [ ASC | DESC ] [ ,...n ] ) ]
{ DISABLE | RESUME}
```
## API
```
+$ alter-index
$:
%alter-index
name=qualified-object
object=qualified-object
columns=(list ordered-column)
action=index-action
==
```
## Arguments
** **
Discussion:
`RESUME` will rebuild the index if the underlying object is dirty.
**`[ <db-qualifer> ]<index>`**
Target index.
## Remarks
The command results in a state change of the Obelisk agent.
Cannot alter primary key and foreign key indices.
`RESUME` will rebuild the index if the underlying object is dirty.
TO DO: investigate hoon ordered maps to determine what exactly "clustered" means in hoon. It may be that multiple clustering indices are possibley, freaking out most DBAs.
## Produced Metadata
## Exceptions
column does not exist
UNIQUE specified and existing values are not unique for the column(s) specified
# ALTER NAMESPACE
```
ALTER NAMESPACE [ <database-name>. ]<namespace-name>
TRANSFER { TABLE | VIEW } [ <db-qualifer> ]{ <table-name> | <view-name> }
ALTER NAMESPACE [ <database>. ]<namespace>
TRANSFER { TABLE | VIEW } [ <db-qualifer> ]{ <table> | <view> }
```
## API
```
+$ alter-namespace
$:
%alter-namespace
database-name=@tas
source-namespace=@tas
object-type=object-type
target-namespace=@tas
target-name=@tas
==
```
## Arguments
** **
Discussion:
The namespace *sys* cannot be altered, nor can objects be transferred in or out of it.
## Remarks
The command results in a state change of the Obelisk agent.
The namespace *sys* cannot be altered, nor can objects be transferred in or out of it.
## Produced Metadata
@ -42,30 +78,29 @@ The namespace *sys* cannot be altered, nor can objects be transferred in or out
# ALTER PROCEDURE
TBD
```
ALTER { PROC | PROCEDURE }
[<db-qualifer>]<procedure-name>
[ { #<parameter-name> <data-type> } ] [ ,...n ]
[<db-qualifer>]<procedure>
[ { #<parameter> <data-type> } ] [ ,...n ]
AS { <urql command>; | *hoon } [ ;...n ]
```
Discussion:
TBD
# ALTER TABLE
```
ALTER TABLE [ <db-qualifer> ]{ <table-name> }
{ ALTER COLUMN ( { <column-name> <aura> } [ ,... n ] )
| ADD COLUMN ( { <column-name> <aura> } [ ,... n ] )
| DROP COLUMN ( { <column-name> } [ ,... n ] )
| ADD FOREIGN KEY <foreign-key-name> (<column-name> [ ,... n ])
REFERENCES [<namespace-name>.]<table-name> (<column-name> [ ,... n ])
ALTER TABLE [ <db-qualifer> ]{ <table> }
{ ALTER COLUMN ( { <column> <aura> } [ ,... n ] )
| ADD COLUMN ( { <column> <aura> } [ ,... n ] )
| DROP COLUMN ( { <column> } [ ,... n ] )
| ADD FOREIGN KEY <foreign-key> (<column> [ ,... n ])
REFERENCES [<namespace>.]<table> (<column> [ ,... n ])
[ ON DELETE { NO ACTION | CASCADE } ]
[ ON UPDATE { NO ACTION | CASCADE } ]
[ ,... n ]
| DROP FOREIGN KEY ( <foreign-key-name> [ ,... n ] } )
| DROP FOREIGN KEY ( <foreign-key> [ ,... n ] } )
```
Example:
@ -74,11 +109,27 @@ ALTER TABLE my-table
DROP FOREIGN KEY fk-1, fk-2
```
## API
```
+$ alter-table
$:
%alter-table
table=qualified-object
alter-columns=(list column)
add-columns=(list column)
drop-columns=(list @tas)
add-foreign-keys=(list foreign-key)
drop-foreign-keys=(list @tas)
==
```
## Arguments
** **
## Remarks
The command results in a state change of the Obelisk agent.
## Produced Metadata
@ -86,29 +137,39 @@ DROP FOREIGN KEY fk-1, fk-2
# ALTER TRIGGER
```
ALTER TRIGGER { [ <db-qualifer> ]{ <trigger-name> } | ALL ]
ON { SERVER | <database.name> | <table-name> | <view-name> }
[ ENABLE | DISABLE ]
```
Discussion:
TBD
```
ALTER TRIGGER { [ <db-qualifer> ]{ <trigger> } | ALL ]
ON { SERVER | <database.name> | <table> | <view> }
[ ENABLE | DISABLE ]
```
# ALTER VIEW
```
ALTER VIEW [ <db-qualifer> ]{ <view-name> }
( { [<alias>.] <column-name> } [ ,...n ] )
ALTER VIEW [ <db-qualifer> ]{ <view> }
( { [<alias>.] <column> } [ ,...n ] )
AS <select_statement>
```
## API
```
+$ alter-view
$:
%alter-view
view=qualified-object
transform
==
```
## Arguments
** **
## Remarks
The command results in a state change of the Obelisk agent.
## Produced Metadata

View File

@ -2,8 +2,29 @@
`DROP DATABASE [ FORCE ] <database-name>`
Discussion:
Only succeeds when no *populated* tables exist in it unless `FORCE` is specified.
## API
```
+$ drop-database
$:
%drop-database
name=@tas
force=?
==
```
## Arguments
** **
## Remarks
The command results in a state change of the Obelisk agent.
Only succeeds when no *populated* tables exist in the database unless `FORCE` is specified.
## Produced Metadata
## Exceptions
# DROP INDEX
@ -13,30 +34,102 @@ DROP INDEX <index-name>
ON [ <db-qualifer> ] { <table-name> | <view-name> }
```
Discussion:
Cannot drop indices whose names begin with "pk-", as these are table primary keys.
## API
```
+$ drop-index
$:
%drop-index
name=@tas
object=qualified-object
==
```
## Arguments
** **
## Remarks
The command results in a state change of the Obelisk agent.
Cannot drop indices whose names begin with "pk-" as these are table primary keys.
drop of fk- same as alter-table
TO DO: update create-index to indicate name must be unique
work out at what level?
how to deal with alter namespace considerations.
## Produced Metadata
## Exceptions
# DROP NAMESPACE
`DROP NAMESPACE [ FORCE ] [ <database-name>. ]<namespace-name>`
Discussion:
## API
```
+$ drop-namespace
$:
%drop-namespace
database-name=@tas
name=@tas
force=?
==
```
## Arguments
** **
## Remarks
The command results in a state change of the Obelisk agent.
Only succeeds when no tables or views are in the namespace, unless `FORCE` is specified, possibly resulting in cascading object drops described in `DROP TABLE`.
Cannot drop namespaces *dbo* and *sys*.
## Produced Metadata
## Exceptions
# DROP TABLE
`DROP TABLE [ FORCE ] [ <db-qualifer> ]{ <table-name> }`
Discussion:
## API
```
+$ drop-table
$:
%drop-table
table=qualified-object
force=?
==
```
## Arguments
** **
## Remarks
The command results in a state change of the Obelisk agent.
Cannot drop if used in a view or foreign key, unless `FORCE` is specified, resulting in cascading object drops.
## Produced Metadata
## Exceptions
# DROP TRIGGER
TBD
```
DROP TRIGGER [ <db-qualifer> ]{ <trigger-name> }
ON { <table-name> | <view-name> }
@ -45,10 +138,12 @@ DROP TRIGGER [ <db-qualifer> ]{ <trigger-name> }
# DROP TYPE
`DROP TYPE <type-name>`
TBD
Discussion:
`DROP TYPE <type-name>`
## Remarks
Cannot drop if type-name is in use.
@ -56,4 +151,27 @@ Cannot drop if type-name is in use.
`DROP VIEW [ FORCE ] [ <db-qualifer> ]<view-name>`
Discussion: Cannot drop if used in another view, unless `FORCE` is specified, resulting in cascading object drops.
## API
```
+$ drop-view
$:
%drop-view
view=qualified-object
force=?
==
```
## Arguments
** **
## Remarks
The command results in a state change of the Obelisk agent.
Cannot drop if used in another view, unless `FORCE` is specified, resulting in cascading object drops.
## Produced Metadata
## Exceptions

View File

@ -41,15 +41,15 @@
$:
%qualified-object
ship=(unit @p)
database=@t
namespace=@t
database=@tas
namespace=@tas
name=@tas
==
+$ qualified-column
$:
%qualified-column
qualifier=qualified-object
column=@t
column=@tas
alias=(unit @t)
==
+$ foreign-key
@ -371,7 +371,8 @@
==
::
:: $drop-namespace: database-name=@tas name=@tas force=?
+$ drop-namespace $:([%drop-namespace database-name=@tas name=@tas force=?])
+$ drop-namespace
$:([%drop-namespace database-name=@tas name=@tas force=?])
::
:: $drop-table: table=qualified-object force=?
+$ drop-table
@ -418,9 +419,9 @@
$:
%alter-namespace
database-name=@tas
source-namespace=@t
source-namespace=@tas
object-type=object-type
target-namespace=@t
target-namespace=@tas
target-name=@tas
==
::
@ -431,9 +432,9 @@
table=qualified-object
alter-columns=(list column)
add-columns=(list column)
drop-columns=(list @t)
drop-columns=(list @tas)
add-foreign-keys=(list foreign-key)
drop-foreign-keys=(list @t)
drop-foreign-keys=(list @tas)
==
::
:: $alter-trigger: TBD