go-reform/reform

Skip sqlite3 tables with incorrect table_info

eschizoid opened this issue · 6 comments

I have a third party database that I cannot change it. Is there a way to silently fail and still generate the correct entities?

reform-db: 2018/11/10 04:33:51.656895 cmd_init_sqlite3.go:85: no such module: spellfix1
panic: no such module: spellfix1

goroutine 1 [running]:
gopkg.in/reform.v1/internal.(*Logger).Fatalf(0xc0000938f0, 0x45377d0, 0x2, 0xc000348a60, 0x1, 0x1)
	/Users/mgonzalez/go/src/gopkg.in/reform.v1/internal/logger.go:51 +0x107
main.initModelsSQLite3(0xc00009c8a0, 0xc0000dbbd0, 0x400b9bd, 0x44dd240)
	/Users/mgonzalez/go/src/gopkg.in/reform.v1/reform-db/cmd_init_sqlite3.go:85 +0x469
main.cmdInit(0xc00009c8a0, 0xc00001e004, 0x1f)
	/Users/mgonzalez/go/src/gopkg.in/reform.v1/reform-db/cmd_init.go:184 +0xb2f
main.main()
	/Users/mgonzalez/go/src/gopkg.in/reform.v1/reform-db/main.go:128 +0x3a4

Something like the following:

https://stackoverflow.com/questions/38425835/reflecting-sqlite-database-with-spellfix1-tables

Edit:
Even better, something like --skip-tables I think would be less invasive?

Is it the same as #174?

@AlekSi Yes, you want me to close this one?

Closing as duplicate of #174.

Ok, that's a somewhat different issue. Reopening.
The proper fix is to log an error and continue to the next loop iteration there. PRs are welcome.

@AlekSi I think that this behavior (skipping failures) should be configurable. How you feel about adding an extra flag to comand-db. Either way I can take the work, just checking what are your thoughts about it.

Is this flag still needed? I can give this a shot