feat: [#635] Optimize the process of generating migration and model#998
feat: [#635] Optimize the process of generating migration and model#998krishankumar01 merged 43 commits intomasterfrom
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #998 +/- ##
==========================================
+ Coverage 69.10% 70.35% +1.24%
==========================================
Files 168 176 +8
Lines 11340 12297 +957
==========================================
+ Hits 7836 8651 +815
- Misses 3152 3265 +113
- Partials 352 381 +29 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.50.
| Benchmark suite | Current: 75c6476 | Previous: a232615 | Ratio |
|---|---|---|---|
BenchmarkFile_ReadWrite |
284984 ns/op 2073 B/op 28 allocs/op |
172419 ns/op 2072 B/op 28 allocs/op |
1.65 |
BenchmarkFile_ReadWrite - ns/op |
284984 ns/op |
172419 ns/op |
1.65 |
This comment was automatically generated by workflow using github-action-benchmark.
There was a problem hiding this comment.
So sorry for the back and forth, due to goravel/goravel#642 (comment), this change may be unnecessary for now. We need a deep investigation into this. We can merge this PR first and create another PR to remove BaseModel, NullableSoftDeletes and NullableTimestamps if you want.
There was a problem hiding this comment.
Will create a separate PR for this
| } | ||
|
|
||
| if column.Autoincrement { | ||
| tagParts = append(tagParts, fmt.Sprintf(`gorm:"%s"`, "autoIncrement")) |
There was a problem hiding this comment.
| tagParts = append(tagParts, fmt.Sprintf(`gorm:"%s"`, "autoIncrement")) | |
| tagParts = append(tagParts, fmt.Sprintf(`gorm:"%s"`, "primaryKey")) |
There was a problem hiding this comment.
PrimaryKey and AutoIncrement are two separate concepts, right?
There was a problem hiding this comment.
Yes, but a AutoIncrement column should be PrimaryKey.
|
CI failed |
hwbrzzl
left a comment
There was a problem hiding this comment.
Great PR 👍 LGTM, only nitpicks on the test cases.


📑 Description
Closes goravel/goravel#635
This PR introduces support for generating a model directly from an existing database table using the
--tableoption.go run . artisan make:model --table=users -f UserExample
Given the following table definition:
Generated Model
Overriding the mapping:
Users can override the default mapping in their app's
app/providers/database_service_provider.go:✅ Checks