question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Enable SQL CREATE PROPERTY to set ATTRIBUTES such as NOT NULL, MANDATORY, and READONLY

See original GitHub issue

Presently quite a few commands are required to create a property in a class that is “not null”, “mandatory”, or “read only”. For example:

CREATE Property User.username STRING
ALTER PROPERTY User.username MANDATORY true
ALTER PROPERTY User.username NOTNULL true
ALTER PROPERTY User.username READONLY true

It would be convenient to be able to do the following (or a mix of the attributes):

CREATE Property User.username STRING MANDATORY NOTNULL READONLY

These attributes would come at the end of the statement. For example if this property was a linked element:

CREATE Property Employee.supervisor LINK Employee MANDATORY NOTNULL READONLY

This would make defining properties in SQL much more succinct. Other properties could be defined as well (DEFAULT, MIN, MAX, etc.). It appears that this change could be made in the OCommandExecutorSQLCreateProperty parse and execute methods.

If this seems like a good feature, I would be willing to create a PR.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:33 (31 by maintainers)

github_iconTop GitHub Comments

1reaction
luigidellaquilacommented, Jun 10, 2016

Little Bobby Tables is always in my heart 😆

I think UNSAFE just didn’t work 😉 What I’m trying to do with the new grammar is to make things as strict as possible, to avoid corner cases and have predictable behavior.

Adding new reserved keywords is an option, but it can make migrations very tricky, so I always try to avoid it if I can, in this case I think commas are an acceptable alternative.

Thanks

Luigi

0reactions
francisco1844commented, Jun 26, 2016

Thanks for the feedback @mmacfadden. Will create a new issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Database Properties (Options Page) - SQL Server
Allow null values for all user-defined data types or columns that are not explicitly defined as NOT NULL during a CREATE TABLE or...
Read more >
Non-nullable property must contain a non-null value when ...
Right click your Project title > Properties > Application > Packaging > Under the "Build" section > Set "Nullable" = "Enable" in the ......
Read more >
SQL - Alter Property · OrientDB Manual
Attribute Type Description MANDATORY Boolean Defines whether the property requires a value. NAME String Defines the property name. TYPE String Defines a property type.
Read more >
SQL NOT NULL Constraint - W3Schools
SQL NOT NULL Constraint. By default, a column can hold NULL values. · SQL NOT NULL on CREATE TABLE. The following SQL ensures...
Read more >
13.1.20 CREATE TABLE Statement - MySQL :: Developer Zone
If you do not have a PRIMARY KEY and an application asks for the PRIMARY KEY in your tables, MySQL returns the first...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found