Skip to content

Commit ef97233

Browse files
committed
Switch from volatiletech to aarondl
1 parent 4ee910e commit ef97233

5 files changed

Lines changed: 50 additions & 49 deletions

File tree

README.md

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# BoilingSeed
22

3-
This is a CLI tool that helps generate database seeding helpers with [`sqlboiler`](https://github.com/volatiletech/sqlboiler).
3+
This is a CLI tool that helps generate database seeding helpers with [`sqlboiler`](https://github.com/aarondl/sqlboiler).
44

55
This is a really early release, so while it works (I use it for my projects), it is not super stable YET.
66

77
## Installation
88

9-
* Install [`sqlboiler`](https://github.com/volatiletech/sqlboiler)
10-
* Install your database driver for [`sqlboiler`](https://github.com/volatiletech/sqlboiler#supported-databases).
11-
* Generate your models. [Link](https://github.com/volatiletech/sqlboiler#initial-generation)
12-
* Install boilingseed: `go get github.com/stephenafamo/boilingseed`
9+
- Install [`sqlboiler`](https://github.com/aarondl/sqlboiler)
10+
- Install your database driver for [`sqlboiler`](https://github.com/aarondl/sqlboiler#supported-databases).
11+
- Generate your models. [Link](https://github.com/aarondl/sqlboiler#initial-generation)
12+
- Install boilingseed: `go get github.com/stephenafamo/boilingseed`
1313

1414
## Usage
1515

@@ -54,14 +54,14 @@ Apart from the standard configuration for SQLBoiler, the only other added config
5454

5555
The program accepts these flags to overwrite any configuration.
5656

57-
* `--sqlboiler-models`: The package of your generated models. Needed to import them properly in the seeder. DEFAULT: `current/go/module/models`.
58-
* `--config`: Configuration file path. DEFAULT: `sqlboiler.toml`
59-
* `--output` or `-o`: The name of the folder to output to. DEFAULT: `seeds`
60-
* `--pkgname` or `-p`: The name you wish to assign to your generated package. DEFAULT: `seeds`
61-
* `--no-context`: Were the models generated with no context?. DEFAULT `false`
62-
* `--wipe`: Delete the output folder (rm -rf) before generation to ensure sanity. DEFAULT `false`
63-
* `--version`: Print the version
64-
* `debug` or `d`: Debug mode prints stack traces on error. DEFAULT `false`
57+
- `--sqlboiler-models`: The package of your generated models. Needed to import them properly in the seeder. DEFAULT: `current/go/module/models`.
58+
- `--config`: Configuration file path. DEFAULT: `sqlboiler.toml`
59+
- `--output` or `-o`: The name of the folder to output to. DEFAULT: `seeds`
60+
- `--pkgname` or `-p`: The name you wish to assign to your generated package. DEFAULT: `seeds`
61+
- `--no-context`: Were the models generated with no context?. DEFAULT `false`
62+
- `--wipe`: Delete the output folder (rm -rf) before generation to ensure sanity. DEFAULT `false`
63+
- `--version`: Print the version
64+
- `debug` or `d`: Debug mode prints stack traces on error. DEFAULT `false`
6565

6666
They can also be set in the config file, or as environment variables
6767

@@ -109,8 +109,6 @@ ALTER TABLE pilot_languages ADD CONSTRAINT pilot_language_pilots_fkey FOREIGN KE
109109
ALTER TABLE pilot_languages ADD CONSTRAINT pilot_language_languages_fkey FOREIGN KEY (language_id) REFERENCES languages(id);
110110
```
111111

112-
113-
114112
The generated package will define a Seeder struct whose fields control seeding.
115113
The comments help understand what each field does.
116114

@@ -178,7 +176,7 @@ seeder.JetsPerPilot = 2
178176

179177
### `MinRelsPerXXX`
180178

181-
The `MinRelsPerXXX` fields are control how many `many-to-many` relationships are added. In this example, it will **try** to give each Pilot *at least* 3 Languages and each Language *at least* 3 pilots.
179+
The `MinRelsPerXXX` fields are control how many `many-to-many` relationships are added. In this example, it will **try** to give each Pilot _at least_ 3 Languages and each Language _at least_ 3 pilots.
182180

183181
Naturally, if there are more pilots than languages, each language will likely have more than 3 pilots.
184182

@@ -188,7 +186,7 @@ seeder.MinRelsPerPilotLanguages = 3
188186

189187
### `RandomXXX`
190188

191-
The package has `defaultRandomXXX` functions that use `github.com/volatiletech/randomize`. However, for better control you can set custom `RandomXXX` functions. A single function that randomly generates a model.
189+
The package has `defaultRandomXXX` functions that use `github.com/aarondl/randomize`. However, for better control you can set custom `RandomXXX` functions. A single function that randomly generates a model.
192190

193191
The `RandomXXX` functions do not need to add any relationships to the models.
194192

@@ -322,9 +320,10 @@ CREATE TABLE book_tags (
322320
The integration tests require:
323321

324322
1. **SQLBoiler** - Must be installed and available in your PATH
323+
325324
```bash
326-
go install github.com/volatiletech/sqlboiler/v4@latest
327-
go install github.com/volatiletech/sqlboiler/v4/drivers/sqlboiler-sqlite3@latest
325+
go install github.com/aarondl/sqlboiler/v4@latest
326+
go install github.com/aarondl/sqlboiler/v4/drivers/sqlboiler-sqlite3@latest
328327
```
329328

330329
2. **Go environment** - The tests create temporary Go modules and build executables
@@ -334,6 +333,7 @@ The integration tests require:
334333
### Test Output
335334

336335
The integration tests provide detailed output showing:
336+
337337
- Database setup and schema creation
338338
- SQLBoiler model generation
339339
- BoilingSeed seeder generation
@@ -342,6 +342,7 @@ The integration tests provide detailed output showing:
342342
- Foreign key relationship validation
343343

344344
Example successful test output:
345+
345346
```
346347
=== RUN TestBoilingSeedIntegration
347348
=== RUN TestBoilingSeedIntegration/DatabaseSetup

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ module github.com/stephenafamo/boilingseed
33
go 1.23.0
44

55
require (
6+
github.com/aarondl/sqlboiler/v4 v4.19.5
67
github.com/spf13/cobra v1.9.1
78
github.com/spf13/viper v1.20.1
8-
github.com/volatiletech/sqlboiler/v4 v4.19.1
99
golang.org/x/mod v0.24.0
1010
modernc.org/sqlite v1.18.1
1111
)
@@ -15,6 +15,8 @@ require (
1515
github.com/Masterminds/goutils v1.1.1 // indirect
1616
github.com/Masterminds/semver/v3 v3.3.1 // indirect
1717
github.com/Masterminds/sprig/v3 v3.3.0 // indirect
18+
github.com/aarondl/inflect v0.0.2 // indirect
19+
github.com/aarondl/strmangle v0.0.9 // indirect
1820
github.com/friendsofgo/errors v0.9.2 // indirect
1921
github.com/fsnotify/fsnotify v1.9.0 // indirect
2022
github.com/go-viper/mapstructure/v2 v2.3.0 // indirect
@@ -36,8 +38,6 @@ require (
3638
github.com/spf13/cast v1.8.0 // indirect
3739
github.com/spf13/pflag v1.0.6 // indirect
3840
github.com/subosito/gotenv v1.6.0 // indirect
39-
github.com/volatiletech/inflect v0.0.1 // indirect
40-
github.com/volatiletech/strmangle v0.0.8 // indirect
4141
go.uber.org/multierr v1.11.0 // indirect
4242
golang.org/x/crypto v0.38.0 // indirect
4343
golang.org/x/sync v0.14.0 // indirect

go.sum

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ github.com/Masterminds/semver/v3 v3.3.1 h1:QtNSWtVZ3nBfk8mAOu/B6v7FMJ+NHTIgUPi7r
66
github.com/Masterminds/semver/v3 v3.3.1/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
77
github.com/Masterminds/sprig/v3 v3.3.0 h1:mQh0Yrg1XPo6vjYXgtf5OtijNAKJRNcTdOOGZe3tPhs=
88
github.com/Masterminds/sprig/v3 v3.3.0/go.mod h1:Zy1iXRYNqNLUolqCpL4uhk6SHUMAOSCzdgBfDb35Lz0=
9+
github.com/aarondl/inflect v0.0.2 h1:XvH8K5g1wKS921tMmDOUsZ3zS1Eo8WwK5RHC0IGGT2s=
10+
github.com/aarondl/inflect v0.0.2/go.mod h1:zjmCfdXHUDQ9jFOV6SeHknpo0Au6rQhV8GchS4Vzv/0=
11+
github.com/aarondl/sqlboiler/v4 v4.19.5 h1:/UW1qvOA+ytXjhDg85E7fDW6iqIGP9xDdqFbtqZ3xL8=
12+
github.com/aarondl/sqlboiler/v4 v4.19.5/go.mod h1:PqsFMK0K44NPrqcO24fnft2ePqK2avLvbqxWqsTXXHk=
13+
github.com/aarondl/strmangle v0.0.9 h1:VCT+O1FqRSE9DTK3qR0zRHtB384fdRzuyKfx2ux2xms=
14+
github.com/aarondl/strmangle v0.0.9/go.mod h1:ezNIwvvnuVGuKedP5qt2T+wvzPD8yuOoMzamifXNMlk=
915
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
1016
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
1117
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -76,12 +82,6 @@ github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOf
7682
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
7783
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
7884
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
79-
github.com/volatiletech/inflect v0.0.1 h1:2a6FcMQyhmPZcLa+uet3VJ8gLn/9svWhJxJYwvE8KsU=
80-
github.com/volatiletech/inflect v0.0.1/go.mod h1:IBti31tG6phkHitLlr5j7shC5SOo//x0AjDzaJU1PLA=
81-
github.com/volatiletech/sqlboiler/v4 v4.19.1 h1:MA1cUQBAUNJ6dezS11GFlbQ9LvtlwuEAsIaUx9WyfNA=
82-
github.com/volatiletech/sqlboiler/v4 v4.19.1/go.mod h1:q10x7FF/cR86pf8VT/0L0FTnLchi8EDhWu/SO55tl9A=
83-
github.com/volatiletech/strmangle v0.0.8 h1:UZkTDFIjZcL1Lk4BXhGsxcyXxNcWuM5ZwdzZc0sJcWg=
84-
github.com/volatiletech/strmangle v0.0.8/go.mod h1:ycDvbDkjDvhC0NUU8w3fWwl5JEMTV56vTKXzR3GeR+0=
8585
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
8686
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
8787
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=

integration_test.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ func (s *IntegrationTestSuite) Setup(t *testing.T) error {
138138
s.binPath = filepath.Join(s.tempDir, "boilingseed")
139139

140140
// Create project directory
141-
if err := os.MkdirAll(s.projectDir, 0755); err != nil {
141+
if err := os.MkdirAll(s.projectDir, 0o755); err != nil {
142142
return fmt.Errorf("failed to create project directory: %w", err)
143143
}
144144

@@ -262,7 +262,7 @@ func (s *IntegrationTestSuite) TestProjectStructure(t *testing.T) {
262262
// Create sqlboiler config
263263
configContent := fmt.Sprintf(sqlBoilerConfig, s.dbPath)
264264
configPath := filepath.Join(s.projectDir, "sqlboiler.toml")
265-
if err := os.WriteFile(configPath, []byte(configContent), 0644); err != nil {
265+
if err := os.WriteFile(configPath, []byte(configContent), 0o644); err != nil {
266266
t.Fatalf("Failed to create config file: %v", err)
267267
}
268268

@@ -279,11 +279,11 @@ func (s *IntegrationTestSuite) TestProjectStructure(t *testing.T) {
279279

280280
func (s *IntegrationTestSuite) TestSQLBoilerGeneration(t *testing.T) {
281281
// Add sqlboiler dependencies
282-
if err := s.runCommand("go", "get", "github.com/volatiletech/sqlboiler/v4"); err != nil {
282+
if err := s.runCommand("go", "get", "github.com/aarondl/sqlboiler/v4"); err != nil {
283283
t.Fatalf("Failed to get sqlboiler dependency: %v", err)
284284
}
285285

286-
if err := s.runCommand("go", "get", "github.com/volatiletech/sqlboiler/v4/drivers/sqlboiler-sqlite3"); err != nil {
286+
if err := s.runCommand("go", "get", "github.com/aarondl/sqlboiler/v4/drivers/sqlboiler-sqlite3"); err != nil {
287287
t.Fatalf("Failed to get sqlite driver: %v", err)
288288
}
289289

@@ -352,7 +352,7 @@ func (s *IntegrationTestSuite) TestBoilingSeedGeneration(t *testing.T) {
352352
func (s *IntegrationTestSuite) TestGeneratedCodeCompilation(t *testing.T) {
353353
// Add required dependencies for seeds
354354
dependencies := []string{
355-
"github.com/volatiletech/randomize",
355+
"github.com/aarondl/randomize",
356356
"github.com/lib/pq", // for database drivers in tests
357357
}
358358

@@ -401,7 +401,7 @@ func main() {
401401
`
402402

403403
testPath := filepath.Join(s.projectDir, "test_seeder.go")
404-
if err := os.WriteFile(testPath, []byte(testProgram), 0644); err != nil {
404+
if err := os.WriteFile(testPath, []byte(testProgram), 0o644); err != nil {
405405
t.Fatalf("Failed to create test program: %v", err)
406406
}
407407

@@ -425,7 +425,7 @@ import (
425425
_ "modernc.org/sqlite"
426426
"testproject/seeds"
427427
"testproject/models"
428-
"github.com/volatiletech/sqlboiler/v4/boil"
428+
"github.com/aarondl/sqlboiler/v4/boil"
429429
)
430430
431431
func main() {
@@ -522,12 +522,12 @@ func main() {
522522
`
523523

524524
testPath := filepath.Join(s.projectDir, "run_seeder.go")
525-
if err := os.WriteFile(testPath, []byte(testProgram), 0644); err != nil {
525+
if err := os.WriteFile(testPath, []byte(testProgram), 0o644); err != nil {
526526
t.Fatalf("Failed to create seeder test program: %v", err)
527527
}
528528

529529
// Get additional dependencies
530-
if err := s.runCommand("go", "get", "github.com/volatiletech/null/v8"); err != nil {
530+
if err := s.runCommand("go", "get", "github.com/aarondl/null/v8"); err != nil {
531531
t.Errorf("Failed to get null dependency: %v", err)
532532
}
533533

@@ -577,7 +577,7 @@ import (
577577
_ "modernc.org/sqlite"
578578
"testproject/seeds"
579579
"testproject/models"
580-
"github.com/volatiletech/null/v8"
580+
"github.com/aarondl/null/v8"
581581
)
582582
583583
func main() {
@@ -663,7 +663,7 @@ func randomInt() int {
663663
`
664664

665665
testPath := filepath.Join(s.projectDir, "custom_seeder.go")
666-
if err := os.WriteFile(testPath, []byte(testProgram), 0644); err != nil {
666+
if err := os.WriteFile(testPath, []byte(testProgram), 0o644); err != nil {
667667
t.Fatalf("Failed to create custom seeder test: %v", err)
668668
}
669669

@@ -700,7 +700,7 @@ import (
700700
_ "modernc.org/sqlite"
701701
"testproject/seeds"
702702
"testproject/models"
703-
"github.com/volatiletech/null/v8"
703+
"github.com/aarondl/null/v8"
704704
)
705705
706706
func main() {
@@ -801,7 +801,7 @@ func main() {
801801
`
802802

803803
testPath := filepath.Join(s.projectDir, "fk_demo.go")
804-
if err := os.WriteFile(testPath, []byte(testProgram), 0644); err != nil {
804+
if err := os.WriteFile(testPath, []byte(testProgram), 0o644); err != nil {
805805
t.Fatalf("Failed to create FK test: %v", err)
806806
}
807807

@@ -866,7 +866,7 @@ func (s *IntegrationTestSuite) TestConfigurationOptions(t *testing.T) {
866866
// Test wipe option
867867
// First create a dummy file in the directory
868868
dummyFile := filepath.Join(customOutputDir, "dummy.txt")
869-
if err := os.WriteFile(dummyFile, []byte("dummy"), 0644); err != nil {
869+
if err := os.WriteFile(dummyFile, []byte("dummy"), 0o644); err != nil {
870870
t.Fatalf("Failed to create dummy file: %v", err)
871871
}
872872

main.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ import (
1010
"strings"
1111
"text/tabwriter"
1212

13+
"github.com/aarondl/sqlboiler/v4/boilingcore"
14+
"github.com/aarondl/sqlboiler/v4/drivers"
15+
"github.com/aarondl/sqlboiler/v4/importers"
1316
"github.com/spf13/cobra"
1417
"github.com/spf13/viper"
15-
"github.com/volatiletech/sqlboiler/v4/boilingcore"
16-
"github.com/volatiletech/sqlboiler/v4/drivers"
17-
"github.com/volatiletech/sqlboiler/v4/importers"
1818
)
1919

2020
//go:embed templates
@@ -293,15 +293,15 @@ func configureImports() importers.Collection {
293293
imports.All.Standard = []string{`"fmt"`, `"math"`}
294294
imports.All.ThirdParty = []string{
295295
fmt.Sprintf(`models "%s"`, modelsPkg),
296-
`"github.com/volatiletech/sqlboiler/v4/boil"`,
297-
`"github.com/volatiletech/sqlboiler/v4/queries"`,
298-
`"github.com/volatiletech/randomize"`,
296+
`"github.com/aarondl/sqlboiler/v4/boil"`,
297+
`"github.com/aarondl/sqlboiler/v4/queries"`,
298+
`"github.com/aarondl/randomize"`,
299299
}
300300
imports.Singleton["boilingseed_main"] = importers.Set{
301301
Standard: []string{`"fmt"`, `"sync"`, `"time"`, `"context"`, `"math/rand"`},
302302
ThirdParty: []string{
303303
fmt.Sprintf(`models "%s"`, modelsPkg),
304-
`"github.com/volatiletech/sqlboiler/v4/boil"`,
304+
`"github.com/aarondl/sqlboiler/v4/boil"`,
305305
},
306306
}
307307

0 commit comments

Comments
 (0)