11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'app/controllers/migflow/api/migrations_controller.rb', line 11
def show
migrations = Parsers::MigrationParser.call(migrations_path: migrations_path)
migration = migrations.find { |m| m[:version] == params[:id] }
return render_error("Migration not found", status: :not_found) unless migration
result = Services::SnapshotBuilder.call(migrations: migrations, up_to_version: params[:id])
snapshot = snapshot_model_from(result[:schema_after], migration[:version])
warnings = Services::ScopedMigrationWarnings.call(snapshot: snapshot, migration: migration, diff: result[:diff])
risk = Services::RiskScorer.new.call(warnings)
render_json(migration: serialize_detail(migration, result, warnings, risk))
end
|