discourse/migrations/lib/common
Gerhard Schlager 89f26da39d
MT: Switch to nested module style across migrations/ (#38564)
Ruby's compact module syntax (`module
Migrations::Database::Schema::DSL`) breaks lexical constant lookup —
`Module.nesting` only includes the innermost constant, so every
cross-module reference must be fully qualified. In practice this means
writing `Migrations::Database::Schema::Helpers` even when you're already
inside `Migrations::Database::Schema`.

Nested module definitions restore the full nesting chain, which brings
several practical benefits:

- **Less verbose code**: references like `Schema::Helpers`,
`Database::IntermediateDB`, or `Converters::Base::ProgressStep` work
without repeating the full path from root
- **Easier to write new code**: contributors don't need to remember
which prefixes are required — if you're inside the namespace, short
names just work
- **Fewer aliasing workarounds**: removes the need for constants like
`MappingType = Migrations::Importer::MappingType` that existed solely to
shorten references
- **Standard Ruby style**: consistent with how most Ruby projects and
gems structure their namespaces

The diff is large but mechanical — no logic changes, just module
wrapping and shortening references that the nesting now resolves.
Generated code (intermediate_db models/enums) keeps fully qualified
references like `Migrations::Database.format_*` since it must work
regardless of the configured output namespace.

- Convert 138 lib files from compact to nested module definitions
- Remove now-redundant fully qualified prefixes and aliases
- Update model and enum writers to generate nested modules with correct
indentation
- Regenerate all intermediate_db models and enums
2026-03-19 18:15:19 +01:00
..
set_store MT: Switch to nested module style across migrations/ (#38564) 2026-03-19 18:15:19 +01:00
class_filter.rb DEV: Add options to run only or skip some steps in converter and importer (#35127) 2025-10-03 16:44:36 +02:00
date_helper.rb REFACTOR: Code generator for migrations IntemerdiateDB 2025-04-07 17:22:36 +02:00
enum.rb MT: Switch to nested module style across migrations/ (#38564) 2026-03-19 18:15:19 +01:00
extended_progress_bar.rb MT: Switch to nested module style across migrations/ (#38564) 2026-03-19 18:15:19 +01:00
fork_manager.rb DEV: Add converter framework for migrations-tooling (#28540) 2024-09-09 17:14:39 +02:00
id.rb DEV: Add Upload to IntermediateDB (#29780) 2025-01-20 23:16:30 +01:00
set_store.rb DEV: Add Migrations::SetStore to work with nested sets of data (#33593) 2025-07-24 12:11:41 +02:00
topological_sorter.rb DEV: Add priority handling and error management in TopologicalSorter (#35191) 2025-10-06 16:29:52 +02:00