Class: Pcrd::Readiness::Manifest
- Inherits:
-
Object
- Object
- Pcrd::Readiness::Manifest
- Defined in:
- lib/pcrd/readiness/manifest.rb
Overview
Builds the target-readiness manifest: for each migrated table, which secondary objects exist on the source, whether the target already has them, and runnable DDL to create the missing ones before cutover.
The load DDL (Schema::DDL) creates only table + primary key; indexes, constraints, grants, etc. are deferred so the bulk load is fast. This turns that deferral from tribal knowledge into an explicit checklist.
Rename/drop aware: an object referencing a dropped column is reported as not-recreatable; one referencing a renamed column is flagged for manual regeneration (its source DDL is shown commented out) rather than emitting silently-wrong SQL.
Sequences/identity are reported as informational — they are restored automatically by ‘pcrd cutover` (Cutover::Sequences), so the manifest does not emit competing DDL for them.
Defined Under Namespace
Constant Summary collapse
- KIND_LABEL =
{ "f" => "foreign key", "u" => "unique constraint", "c" => "check constraint" }.freeze
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(source_pool:, target_pool:, config:) ⇒ Manifest
constructor
A new instance of Manifest.
Constructor Details
#initialize(source_pool:, target_pool:, config:) ⇒ Manifest
Returns a new instance of Manifest.
31 32 33 34 35 |
# File 'lib/pcrd/readiness/manifest.rb', line 31 def initialize(source_pool:, target_pool:, config:) @source = source_pool @target = target_pool @config = config end |
Instance Method Details
#build ⇒ Object
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/pcrd/readiness/manifest.rb', line 37 def build src = Schema::ObjectReader.new(@source) tgt = Schema::ObjectReader.new(@target) tables = (@config.migrate&.tables || []).map do |table_config| Table.new(table_name: table_config.name, entries: entries_for(table_config, src, tgt)) end Result.new(tables: tables) end |