--- source_files: - DataPRO/Modules/Database/DatabaseMigrator/Properties/AssemblyInfo.cs - DataPRO/Modules/Database/DatabaseMigrator/Properties/Settings.Designer.cs generated_at: "2026-04-16T04:35:23.176246+00:00" model: "Qwen/Qwen3-Coder-Next-FP8" schema_version: 1 sha256: "044034bedb979c6c" --- # Properties ## Documentation: DatabaseMigrator Module ### 1. Purpose This module provides infrastructure and configuration for managing SQL Server LocalDB instance lifecycle and database schema migrations within the DataPRO system. It is responsible for defining application-scoped and user-scoped settings that control LocalDB operations (e.g., create/start/stop/delete instances), file naming conventions, registry paths, and user-facing messages (e.g., migration success/failure notifications). It does *not* contain migration logic itself (e.g., no migration scripts or versioning engine visible here), but supplies the configuration layer required by other components to orchestrate migrations and interact with LocalDB. ### 2. Public Interface The only public surface exposed by this module is the auto-generated `Settings` class in the `DatabaseMigrator.Properties` namespace. All members are static properties accessed via `DatabaseMigrator.Properties.Settings.Default`. | Property | Type | Scope | Default Value | Description | |---------|------|-------|---------------|-------------| | `LocalDbDataPROInstance` | `string` | Application-scoped | `"(localdb)\DataPROInstance"` | Name of the LocalDB instance used by DataPRO. | | `StopDataProInstance` | `string` | Application-scoped | `"stop DataPROInstance"` | Command fragment used to stop the LocalDB instance (likely part of a larger command string). | | `Warning` | `string` | Application-scoped | `"Warning"` | Literal string used in warning messages. | | `DeleteDataProInstance` | `string` | Application-scoped | `"delete DataPROInstance"` | Command fragment used to delete the LocalDB instance. | | `CreateDataProInstance` | `string` | Application-scoped | `"create DataPROInstance"` | Command fragment used to create the LocalDB instance. | | `StartDataProInstance` | `string` | Application-scoped | `"start DataPROInstance"` | Command fragment used to start the LocalDB instance. | | `LocalDbFolder` | `string` | Application-scoped | `"db"` | Default folder name for LocalDB database files (e.g., relative path). | | `DataPRO` | `string` | Application-scoped | `"DataPRO"` | Product identifier string. | | `ISO` | `string` | Application-scoped | `"ISO"` | Likely used for locale or collation settings. | | `Mdf` | `string` | Application-scoped | `".mdf"` | File extension for primary database files. | | `LogLdf` | `string` | Application-scoped | `"_log.ldf"` | Suffix for transaction log files. | | `SqlServerLocalDbNotInstalled` | `string` | Application-scoped | `"SQL Server LocalDb is not installed."` | User-facing error message. | | `SqlLocalDBExe` | `string` | Application-scoped | `"SqlLocalDB.exe"` | Executable name for the LocalDB CLI tool. | | `ScriptsFolder` | `string` | Application-scoped | `"SQL Server Scripts"` | Folder name containing SQL scripts (e.g., migration scripts). | | `AttachDBsbat` | `string` | Application-scoped | `"AttachDBs.bat"` | Batch file name used to attach databases. | | `RegistrySoftwareMicrosoftMicrosoftSQLServerLocalDBInstalledVersions` | `string` | Application-scoped | `"SOFTWARE\\Microsoft\\Microsoft SQL Server Local DB\\Installed Versions"` | Registry path to check LocalDB installation status. | | `InstanceAPIPath` | `string` | Application-scoped | `"InstanceAPIPath"` | Key name for registry value storing LocalDB instance path. | | `SqlUserInstanceDll` | `string` | Application-scoped | `"SqlUserInstance.dll"` | Name of a LocalDB-related DLL (likely for user-instance support). | | `LocalDB` | `string` | Application-scoped | `"LocalDB"` | Generic identifier for LocalDB. | | `Tools` | `string` | Application-scoped | `"Tools"` | Folder name for tools (e.g., `SqlLocalDB.exe` location). | | `Db` | `string` | Application-scoped | `".db"` | Alternative database file extension (possibly legacy). | | `SameVersionDatabase` | `string` | Application-scoped | `"Database is already version {0} - no migration needed."` | Message template for no-op migration case. | | `ActionRequired` | `string` | Application-scoped | `"Action required"` | Prefix for user prompts requiring manual intervention. | | `CurrentVersionGreater` | `string` | Application-scoped | `"The current database version ({0}) is greater than what is requested. Downward migration is not available."` | Error message for downgrade attempt. | | `DatabaseMigrationFailed` | `string` | Application-scoped | `"Database migration has failed.{0}Previous version of DataPRO must be used. Please contact DTS Support."` | Critical failure message. | | `DatabaseMigrationSucceeded` | `string` | User-scoped | `"Database has been migrated from version {0} to {1}."` | Success message template (user-scoped, modifiable at runtime). | | `WarningAllowStreamingModesWasNotMigrated` | `string` | User-scoped | `"Warning: The AllowStreaming config setting was not migrated and has been set to False.{0}{0}An \"Allow streaming modes\" checkbox is now in the \"Test setup settings\" step of the \"System Settings\" tab."` | Warning about legacy config migration gap (user-scoped). | | `CreatingBackupDb` | `string` | User-scoped | `"Creating a backup database..."` | Status message during backup creation (user-scoped). | ### 3. Invariants - All application-scoped settings are immutable at runtime (read-only; set only at compile-time via `DefaultSettingValueAttribute`). - User-scoped settings (`DatabaseMigrationSucceeded`, `WarningAllowStreamingModesWasNotMigrated`, `CreatingBackupDb`) may be modified programmatically and persisted per-user. - String values are used verbatim in command-line invocations (e.g., `SqlLocalDB.exe` commands), implying strict formatting expectations (e.g., instance names must match exactly). - File extensions (`Mdf`, `LogLdf`, `Db`) are assumed to be consistent with SQL Server LocalDB conventions (`.mdf`, `_log.ldf`, `.db`). - Registry path `RegistrySoftwareMicrosoftMicrosoftSQLServerLocalDBInstalledVersions` must exist and contain version keys for LocalDB detection to function. ### 4. Dependencies **Depends on:** - `System.Configuration` (for `ApplicationSettingsBase`, `ApplicationScopedSettingAttribute`, `UserScopedSettingAttribute`). - `System.Runtime.CompilerServices` (for `CompilerGeneratedAttribute`). - `System.CodeDom.Compiler` (for `GeneratedCodeAttribute`). - `System.Diagnostics` (for `DebuggerNonUserCodeAttribute`). - Implicitly depends on `SqlLocalDB.exe` being installed and accessible (via `Tools`/`SqlLocalDBExe` settings). - Implicitly depends on SQL Server LocalDB runtime components (e.g., `SqlUserInstance.dll`). **Depended on by:** - Other modules in `DataPRO/Modules/Database/DatabaseMigrator` (e.g., migration orchestration logic, instance management classes) — not visible in this source but implied by module structure. - Likely consumed by UI components (e.g., to display messages like `DatabaseMigrationFailed`, `WarningAllowStreamingModesWasNotMigrated`). ### 5. Gotchas - **Hardcoded instance name**: The LocalDB instance name `DataPROInstance` is hardcoded in multiple settings (`LocalDbDataPROInstance`, `StopDataProInstance`, etc.). Renaming the instance requires coordinated changes across all related settings. - **User-scoped settings are mutable**: Settings like `DatabaseMigrationSucceeded` can be altered at runtime and persisted, which may cause unexpected behavior if modified by users or other components. - **Legacy config gap**: `WarningAllowStreamingModesWasNotMigrated` explicitly indicates a known migration gap for a deprecated setting (`AllowStreaming`), suggesting incomplete backward compatibility. - **No versioning metadata**: This file contains no versioning information for migrations (e.g., no schema version constants or migration script ordering). Version tracking must be handled elsewhere. - **Batch file assumption**: `AttachDBsbat` implies an external batch script (`AttachDBs.bat`) exists and is correctly structured; its absence or misconfiguration would cause failures. - **Registry path format**: The registry path uses double backslashes (`\\`) in the source (as required for C# string literals), but this is correct for registry key paths. Ensure no accidental escaping errors in consuming code. - **No public API beyond `Settings`**: This module exposes *only* configuration; actual migration logic resides in other files (not provided here). Do not assume migration behavior from this file alone.