-
Couldn't load subscription status.
- Fork 565
Added support for computed columns #1367
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for computed columns in SQL Server, allowing developers to define virtual columns with computed expressions that can be either virtual (not stored) or persisted (stored). The implementation follows SQL Server's computed column syntax and integrates with Rails' Active Record column definition system.
Key changes:
- Added virtual column support with
t.virtualsyntax in table definitions - Implemented computed column detection and metadata extraction from SQL Server system tables
- Enhanced schema dumping to preserve virtual column definitions
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/cases/virtual_column_test_sqlserver.rb | Comprehensive test suite for virtual column functionality |
| test/cases/coerced_tests.rb | Added :as and :stored as valid column options |
| lib/active_record/connection_adapters/sqlserver_column.rb | Extended Column class with virtual column support methods |
| lib/active_record/connection_adapters/sqlserver_adapter.rb | Added supports_virtual_columns? capability |
| lib/active_record/connection_adapters/sqlserver/table_definition.rb | Added virtual column options to table definition |
| lib/active_record/connection_adapters/sqlserver/schema_statements.rb | Enhanced column metadata extraction for computed columns |
| lib/active_record/connection_adapters/sqlserver/schema_dumper.rb | Added virtual column dumping support and fixed typo |
| lib/active_record/connection_adapters/sqlserver/schema_creation.rb | Added SQL generation for virtual column definitions |
| CHANGELOG.md | Added entry for computed columns feature |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
lib/active_record/connection_adapters/sqlserver/schema_statements.rb
Outdated
Show resolved
Hide resolved
|
Yeah! This also closes #1346 |
Added support for computed columns (#1346).
Computed columns can be virtual
stored: false(default) or persistedstored: true.Ref: