Merged
Conversation
There was a problem hiding this comment.
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added support for computed columns (#1346).
Computed columns can be virtual
stored: false(default) or persistedstored: true.Ref: