We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This is a sub-issue of #94 that focuses on adding a new field constraint.
We should be able to do the following:
genji> CREATE TABLE foo; genji> INSERT INTO foo VALUES {name: "John Doe"}; genji> ALTER TABLE foo ADD FIELD age int;
If the field age already exists, we should return an error.
age
The only constraint supported for now would be NOT NULL but a default value must be specified for the existing documents.
NOT NULL
genji> ALTER TABLE foo ADD FIELD age int NOT NULL DEFAULT 50; genji> SELECT * FROM foo; { "name": "John Doe", "age": 50 }
We should also support the dot notation structure. For example:
genji> ALTER TABLE foo ADD FIELD adress.zip int; genji> INSERT INTO foo VALUES {name: "John Wick", age: 50, adress: {zip:75000}}; genji> SELECT * FROM foo; { "name": "John Wick", "age": 50, "adress": { "zip": 75000 } } genji> INSERT INTO foo VALUES {name: "John Wick", age: 50, adress: {zip:"Paris"}}; cannot convert "text" to "int64": type "text" incompatible with "integer"
The same goes for arrays:
genji> ALTER TABLE foo ADD FIELD animals.0 text; genji> INSERT INTO foo VALUES {name: "John Lennon", age: 50, animals: ["bird"]}; genji> SELECT * FROM foo; { "name": "John Lennon", "age": 50, "animals": [ "cat", ] } genji> INSERT INTO foo VALUES {name: "John Lennon", age: 50, animals: [127]}; cannot convert "int8" to "string"
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
This is a sub-issue of #94 that focuses on adding a new field constraint.
We should be able to do the following:
If the field
age
already exists, we should return an error.NOT NULL
The only constraint supported for now would be
NOT NULL
but a default value must be specified for the existing documents.Dot notation
We should also support the dot notation structure.
For example:
The same goes for arrays:
The text was updated successfully, but these errors were encountered: