Background
Oracle 12c introduced GENERATED columns:
-- Virtual (computed at read time)
ALTER TABLE products ADD full_name VARCHAR2(200) GENERATED ALWAYS AS (first_name || ' ' || last_name) VIRTUAL;
-- Stored (persisted)
ALTER TABLE products ADD full_name VARCHAR2(200) GENERATED ALWAYS AS (first_name || ' ' || last_name) STORED;
oracle-enhanced supports the VIRTUAL form via the :as option since long ago (see OracleEnhanced::TableDefinition's :as option in valid_column_definition_options).
Rails 7.1+ standardised the generated: { type: :stored | :virtual, expression: "..." } keyword for add_column / change_column (see PostgreSQL's add_column_options! for the as: / stored: mapping). Oracle 12c+ supports both VIRTUAL and STORED, but oracle-enhanced has not been audited against Rails' standardised keyword.
Question to resolve
- Does
add_column :t, :col, :string, as: "...", stored: true (or the newer generated: { ... } form) flow through to Oracle as GENERATED ALWAYS AS (...) STORED?
- Does the schema dumper round-trip the stored vs virtual distinction?
- Does
change_column handle the same?
Verification steps
- Read
Rails::Generators::Migration migrations for the standardised generated-column DSL across Rails 7.0 / 7.1 / 7.2 / 8.0 / 8.1 / 8.2 — pin which keyword form is current
- Probe
oracle-enhanced against each form, observing emitted DDL
- Where DDL is wrong / missing, decide whether to add a Rails 8.2-versioned
MigrationCompatibility module (so older migrations keep their existing :as-only behavior)
- Update schema_dumper to dump the correct form
Out of scope
Why now
Surfaced during the survey for #2702 / #2710. The VIRTUAL path predates STORED; STORED has been quietly supported by Oracle for over a decade. Worth a short audit to confirm AR's standardised DSL passes through correctly.
Background
Oracle 12c introduced GENERATED columns:
oracle-enhanced supports the VIRTUAL form via the
:asoption since long ago (seeOracleEnhanced::TableDefinition's:asoption invalid_column_definition_options).Rails 7.1+ standardised the
generated: { type: :stored | :virtual, expression: "..." }keyword foradd_column/change_column(see PostgreSQL'sadd_column_options!for theas:/stored:mapping). Oracle 12c+ supports both VIRTUAL and STORED, but oracle-enhanced has not been audited against Rails' standardised keyword.Question to resolve
add_column :t, :col, :string, as: "...", stored: true(or the newergenerated: { ... }form) flow through to Oracle asGENERATED ALWAYS AS (...) STORED?change_columnhandle the same?Verification steps
Rails::Generators::Migrationmigrations for the standardised generated-column DSL across Rails 7.0 / 7.1 / 7.2 / 8.0 / 8.1 / 8.2 — pin which keyword form is currentoracle-enhancedagainst each form, observing emitted DDLMigrationCompatibilitymodule (so older migrations keep their existing:as-only behavior)Out of scope
identity: truesince Oracle 12.1+ and Phase 2: Auto-enable identity primary keys in Migration[8.2]+ (depends on Rails per-adapter-migration-compatibility) [DRAFT] #2596 wires the Migration[8.2] default)primary_key_trigger:Why now
Surfaced during the survey for #2702 / #2710. The VIRTUAL path predates STORED; STORED has been quietly supported by Oracle for over a decade. Worth a short audit to confirm AR's standardised DSL passes through correctly.