- Purpose: Compare database schemas and export DDL to reconcile differences.
- Scope: Start simple with core objects; provide a toggle to include/ignore partitions.
- Tables: Compare by name, columns, types, nullability, default values, primary keys.
- Columns: Compare name, data type (incl. length/precision/scale), nullability, default.
- Primary Keys: Compare involved column list and order. Do not compare constraint names.
- Foreign Keys: Compare referenced table, column list and order. Do not compare constraint names.
- Unique Constraints: Compare column list and order. Ignore constraint names.
- Indexes: Compare column list and order (and uniqueness). Ignore index names.
- Sequences/Identity: Do not compare names; compare presence/usage and numeric type.
- Partitions: Option to include partitioned tables vs. compare only parent definitions.
- Include partitions: When enabled, partition definitions are considered; when disabled, only parent table structure is compared.
- New WinForms screen: “Schema Compare & DDL Exporter”.
- Two connection setups (Source and Target) with provider selection.
- Checkbox: “Include partitions in comparison”.
- Buttons: Compare, Export DDL (disabled until a diff is available).
- Result area: Text panel to show summary of differences (placeholder for now).
- Documentation: This file with plan, progress, and open questions.
- Audit repository and identify UI patterns
- Create this plan and questions document
- Scaffold Schema Compare form (UI only)
- Add toolbar entry in Main to open the tool
- Wire options and stub Compare/Export actions
- Implement initial comparison engine (tables/columns/PK)
- Implement DDL generation (PostgreSQL + generic fallback)
- Extend loaders to include indexes/FKs (by columns only)
- Compare and generate DDL for indexes and FKs
- Add UI toggles: include indexes/FKs and use guards
- Apply IF NOT EXISTS guards where supported (PostgreSQL: CREATE TABLE/INDEX, ADD COLUMN)
- Add copy-to-clipboard for generated DDL
- Add simple progress indicator (status label + UI disable) during compare
- Supported engines: Which databases must be compared initially (SQL Server, PostgreSQL, MySQL, Oracle, Firebird, SQLite)? PostgreSQL only
- Cross-engine comparisons: Should we allow comparing different engines (e.g., Postgres → SQL Server) or same-engine only for now? Not now
- Connection sources: Reuse saved connections from settings, or always ad‑hoc per compare session? Reuse, may be we could create a pool of connections, instead of replicating the connection string.
- Schema scope: Compare a single schema vs. all non-system schemas? Need include/exclude filters? We should, select the schemas to compare.
- Object coverage: Are views, triggers, functions, and materialized views in scope now or later? Only tables.
- Defaults and computed: Should we compare default expressions and computed/generated columns? How to handle engine-specific expressions? Ignore them
- Collation/encoding: Compare collations/charsets? If so, per column and/or database-level? Not now
- Identity/sequence: How to normalize identity/serial vs. explicit sequences for cross-engine comparison? Check of if it has sequnce or indentity on both sides, the rest Ignore.
- Partitions: For which engines to support partition awareness first (e.g., Postgres, SQL Server)? How to treat subpartitioning? Handle main table only, will we improve it in the future.
- DDL target: Generate DDL for the target engine only, or produce a neutral diff plus per-engine renderers? only Same engine now.
- DDL content: Should scripts include CREATE/ALTER/DROP for all deltas, and ordering to satisfy dependencies (PK → FK)? I don't know, mark as future roadmap.
- Safety: Include IF EXISTS/IF NOT EXISTS guards? Wrap in transaction? Optionally output ROLLBACK-able scripts? If exists wher possible, no transactions now.
- Output format: Show script in UI only, copy to clipboard, and/or Save As to file? Preferred default path? Show in up, so we can copy and paste.
- Naming/casing: Case sensitivity and quoting rules per engine—apply when comparing or when rendering? Make it parametrized.
- Performance: Expected schema size; need pagination or background worker with progress for large catalogs? not now.
- Localization: UI language preferences (English/PT-BR)? Use existing resources or keep English-only initially? English only.
- Exclusions: Any object name patterns or schemas to always ignore (e.g., system schemas)? ignore system schemas
- Tests: Preferred engines and sample databases available for validation? Tests will be run manually.
- Implemented comparison using
DbCon+DbSchemaLoaderto normalize tables/columns/PK. - DDL generation supports PostgreSQL specifically, with a generic fallback for other engines.
- Defaults applied from answers: same-engine only; tables-only; ignore defaults/collation; handle main table only for partitions.
- Next: add loaders and compare logic for indexes/unique/FKs (column lists only), and add guarded DDL where possible.