Skip to content
New issue

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

[5.7] Add computed support to SQL Server schema grammar #27346

Merged
merged 4 commits into from
Jan 30, 2019

Conversation

jlsjonas
Copy link
Contributor

SQL Server also supports computed columns (Azure & 2016+), but as a type; not a modifier.

inspired by #13430 but for SQL Server
Sadly enough SQL Server defines this instead of a data type, so I couldn't re-use the existing methods.

Instead, a "virtual" type was introduced, with a "persisted" modifier; reflecting the mysql-only virtualAs & storedAs modifiers respectively.

@GrahamCampbell GrahamCampbell changed the title Add computed support to SQL Server schema grammar [5.7] Add computed support to SQL Server schema grammar Jan 29, 2019
@GrahamCampbell
Copy link
Member

Sorry, wrong button!

@jlsjonas
Copy link
Contributor Author

Tests should actually work out now 😅 🤞

@staudenmeir
Copy link
Contributor

staudenmeir commented Jan 29, 2019

IMO, virtual() is not an ideal method name. If you add the ->persisted() modifier, you create a "virtual" column that isn't actually virtual.

I would prefer generated() (used for MySQL's virtualAs() and storedAs()) or computed() (used in SQL Server documentation).

@jlsjonas
Copy link
Contributor Author

(cleaned up commits)

@staudenmeir
Copy link
Contributor

Excellent, MySqlGrammar::typeComputed() is a great addition.

@taylorotwell taylorotwell merged commit 5443dca into laravel:5.7 Jan 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants