feat(relations): 🎉 add flatten schema option for output
All checks were successful
CI / Test (1.24) (push) Successful in -25m5s
CI / Test (1.25) (push) Successful in -24m57s
CI / Build (push) Successful in -26m5s
CI / Lint (push) Successful in -25m51s
Integration Tests / Integration Tests (push) Successful in -25m42s
Release / Build and Release (push) Successful in -24m39s
All checks were successful
CI / Test (1.24) (push) Successful in -25m5s
CI / Test (1.25) (push) Successful in -24m57s
CI / Build (push) Successful in -26m5s
CI / Lint (push) Successful in -25m51s
Integration Tests / Integration Tests (push) Successful in -25m42s
Release / Build and Release (push) Successful in -24m39s
* Introduce `--flatten-schema` flag to convert, merge, and split commands. * Modify database writing functions to support flattened schema names. * Update template functions to handle schema.table naming convention. * Enhance PostgreSQL writer to utilize flattened schema in generated SQL. * Update tests to ensure compatibility with new flattening feature. * Dependencies updated for improved functionality.
This commit is contained in:
@@ -83,7 +83,7 @@ func (w *Writer) writeSingleFile(db *models.Database) error {
|
||||
// Collect all models
|
||||
for _, schema := range db.Schemas {
|
||||
for _, table := range schema.Tables {
|
||||
modelData := NewModelData(table, schema.Name, w.typeMapper)
|
||||
modelData := NewModelData(table, schema.Name, w.typeMapper, w.options.FlattenSchema)
|
||||
|
||||
// Add relationship fields
|
||||
w.addRelationshipFields(modelData, table, schema, db)
|
||||
@@ -175,7 +175,7 @@ func (w *Writer) writeMultiFile(db *models.Database) error {
|
||||
templateData.AddImport(fmt.Sprintf("sql_types \"%s\"", w.typeMapper.GetSQLTypesImport()))
|
||||
|
||||
// Create model data
|
||||
modelData := NewModelData(table, schema.Name, w.typeMapper)
|
||||
modelData := NewModelData(table, schema.Name, w.typeMapper, w.options.FlattenSchema)
|
||||
|
||||
// Add relationship fields
|
||||
w.addRelationshipFields(modelData, table, schema, db)
|
||||
|
||||
Reference in New Issue
Block a user