-
Notifications
You must be signed in to change notification settings - Fork 0
feat: enhance new:domain with dynamic database config and CLI flags #187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Updated both CLAUDE.md and README.md to document the new features: - CLI flags for non-interactive mode (--domain-path, --db-type, etc.) - Dynamic database loading from .local-migrate-config.yml - PascalCase conversion for provider function names - Mockery action integration with context support - Usage examples for interactive, non-interactive, and mixed modes - Database configuration workflow Changes include: - Added comprehensive flag documentation - Explained database configuration from .local-migrate-config.yml - Documented PascalCase conversion (user_preferences -> ProvideUserPreferences) - Updated mockery integration section - Added migrateconfig utility to project structure - Enhanced usage examples with all three modes Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Comment on lines
+87
to
103
| if input.DBName != "" { | ||
| validDBName := false | ||
| for _, dbName := range databases { | ||
| if dbName == input.DBName { | ||
| validDBName = true | ||
| break | ||
| } | ||
| } | ||
|
|
||
| if !validDBName { | ||
| availableDBs := make([]string, 0, len(databases)) | ||
| for _, dbName := range databases { | ||
| availableDBs = append(availableDBs, dbName) | ||
| } | ||
| return fmt.Errorf("invalid db-name '%s': must be one of %v", input.DBName, availableDBs) | ||
| } | ||
| } |
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested change
| if input.DBName != "" { | |
| validDBName := false | |
| for _, dbName := range databases { | |
| if dbName == input.DBName { | |
| validDBName = true | |
| break | |
| } | |
| } | |
| if !validDBName { | |
| availableDBs := make([]string, 0, len(databases)) | |
| for _, dbName := range databases { | |
| availableDBs = append(availableDBs, dbName) | |
| } | |
| return fmt.Errorf("invalid db-name '%s': must be one of %v", input.DBName, availableDBs) | |
| } | |
| } | |
| if input.DBName != "" { | |
| validDBName := false | |
| availableDBs := make([]string, 0, len(databases)) | |
| for _, dbName := range databases { | |
| availableDBs = append(availableDBs, dbName) | |
| if dbName == input.DBName { | |
| validDBName = true | |
| break | |
| } | |
| } | |
| if !validDBName { | |
| return fmt.Errorf("invalid db-name '%s': must be one of %v", input.DBName, availableDBs) | |
| } | |
| } |
podriamos evitar iterar dos veces databases
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Enhanced the
new:domaincommand with three major improvements:.local-migrate-config.ymlwith PascalCase provider namingKey Changes
1. Mockery Integration Refactor
internal/actions/newdomain/mockery.go2. CLI Flags for Non-Interactive Mode
Added five new flags to skip interactive prompts:
--domain-path, -p: Path to the domain folder--db-type: Database type (postgres or dynamo)--table-name: Database table name--db-prefix: ID prefix for Postgres (3 characters)--db-name: Database name for PostgresUpdated form logic to:
3. Dynamic Database Configuration
Created new utility:
internal/pkg/migrateconfig/.local-migrate-config.ymlfrom project rootmigrations.databasesconfigurationuser_preferences→ProvideUserPreferencesgames_core→ProvideGamesCoreUpdated postgres form to dynamically load databases instead of static list
4. Template Fixes
//go:embeddirective to include.mockery.pkg.yml.tmplfilesProvideGeneral()callproviders.MustAs[gorm.Driver]for type assertiongormimport5. Enhanced Documentation
Updated command help with:
Test Results
✅ Postgres domain creation with flags
✅ DynamoDB domain creation with flags
✅ Dynamic database loading from config
✅ Test database filtering
✅ PascalCase conversion (user_preferences → ProvideUserPreferences)
✅ Mock generation with concurrent execution
Breaking Changes
None. All changes are backwards compatible with existing workflows.
Usage Examples
Interactive Mode (existing behavior)
Non-Interactive Mode (new)
Mixed Mode (new)
draft new:domain --domain-path orders --db-type postgres # Prompts only for table-name, db-prefix, and db-nameTechnical Details
Files Modified: 16 files
Lines Changed: +470, -170
🤖 Generated with Claude Code