bugfix: Enforce TYPE RELATION
(#3732)
This commit is contained in:
parent
e00c456389
commit
ce8e2d4578
4 changed files with 3 additions and 8 deletions
|
@ -29,7 +29,7 @@ pub fn table(i: &str) -> IResult<&str, DefineTableStatement> {
|
|||
let (i, name) = cut(ident)(i)?;
|
||||
let (i, opts) = many0(table_opts)(i)?;
|
||||
let (i, _) = expected(
|
||||
"TYPE, RELATION, DROP, SCHEMALESS, SCHEMAFUL(L), VIEW, CHANGEFEED, PERMISSIONS, or COMMENT",
|
||||
"TYPE, DROP, SCHEMALESS, SCHEMAFUL(L), VIEW, CHANGEFEED, PERMISSIONS, or COMMENT",
|
||||
ending::query,
|
||||
)(i)?;
|
||||
// Create the base statement
|
||||
|
@ -129,7 +129,6 @@ fn table_opts(i: &str) -> IResult<&str, DefineTableOption> {
|
|||
table_permissions,
|
||||
table_changefeed,
|
||||
table_type,
|
||||
table_relation,
|
||||
))(i)
|
||||
}
|
||||
|
||||
|
|
|
@ -354,10 +354,6 @@ impl Parser<'_> {
|
|||
self.pop_peek();
|
||||
res.drop = true;
|
||||
}
|
||||
t!("RELATION") => {
|
||||
self.pop_peek();
|
||||
res.kind = TableType::Relation(self.parse_relation_schema()?);
|
||||
}
|
||||
t!("TYPE") => {
|
||||
self.pop_peek();
|
||||
match self.peek_kind() {
|
||||
|
|
|
@ -2648,7 +2648,7 @@ async fn redefining_existing_user_with_if_not_exists_should_error() -> Result<()
|
|||
#[cfg(feature = "sql2")]
|
||||
async fn define_table_relation() -> Result<(), Error> {
|
||||
let sql = "
|
||||
DEFINE TABLE likes RELATION;
|
||||
DEFINE TABLE likes TYPE RELATION;
|
||||
CREATE person:raphael, person:tobie;
|
||||
RELATE person:raphael->likes->person:tobie;
|
||||
CREATE likes:1;
|
||||
|
|
|
@ -789,7 +789,7 @@ async fn field_definition_edge_permissions() -> Result<(), Error> {
|
|||
DEFINE TABLE user SCHEMAFULL;
|
||||
DEFINE TABLE business SCHEMAFULL;
|
||||
DEFINE FIELD owner ON TABLE business TYPE record<user>;
|
||||
DEFINE TABLE contact RELATION SCHEMAFULL PERMISSIONS FOR create WHERE in.owner.id = $auth.id;
|
||||
DEFINE TABLE contact TYPE RELATION SCHEMAFULL PERMISSIONS FOR create WHERE in.owner.id = $auth.id;
|
||||
INSERT INTO user (id, name) VALUES (user:one, 'John'), (user:two, 'Lucy');
|
||||
INSERT INTO business (id, owner) VALUES (business:one, user:one), (business:two, user:two);
|
||||
";
|
||||
|
|
Loading…
Reference in a new issue