Breaking Changes
Package and Functions
Most of boil
got put into a queries
package. This is to simplify the public
interface of boil
. There was a lot of things in there that we didn't want exposed.
We wanted to make the execution of raw queries simpler
so we added the helpers to actually make the Query
object itself
a real boil.Executor
.
Before | After |
---|---|
boil.SQL() | queries.Raw() |
boil.ExecQuery() | (*queries.Query).Exec() |
boil.ExecQueryOne() | (*queries.Query).QueryRow() |
boil.ExecQueryAll() | (*queries.Query).Query() |
Before | After |
---|---|
github.com/vattle/sqlboiler/boil/qm | github.com/vattle/sqlboiler/queries/qm |
Command-line arguments
This change was mostly done because whitelist
and exclude
seemed sort of
disjoint. This has the unfortunate side-effect of stealing the -b
from
basedir
, but no one should need that option in regular cases anyway.
Before | After |
---|---|
-x --exclude | -b --blacklist |
-b --basedir | --basedir |
JSON and JSONb types
json
and jsonb
fields used to be represented by bytes
but it's now
generated as types.JSON which uses a []byte for underlying storage, but
comes with proper marshaling and nil treatment.
JSON is now recognized as an acronym and will be uppercased appropriately
in struct field names.
See the types details.
Backwards Compatible Changes
MySQL Support
MySQL is now supported. Currently ANSI_QUOTES
option must be set to
to the default "off" in MySQL for this to work, but the basics should be fully
supported by SQLBoiler now. See README for configuration details.
Additional Types
The types
package has been added which adds additional support for various
types.
- Postgres Arrays (byte, string, int, bool, float all supported)
- HStore
Whitelist
--whitelist
-w
now usable from the command-line to specify only the
tables you want to generate.
Schema support
--schema
-s
now usable from the command-line to specify which schema to target.
We added schema support in this release to be able to narrow down in Postgres
the set of tables that you were going to generate. If you need multiple schemas
to be generated, simply run SQLBoiler multiple times with the different schema
and package names.
In MySQL the schema name is automatically set to the database name.
Miscellaneous changes and bug fixes
- Upsert has been optimized to use caching, now over 10x faster.
- Fixed a panic when passing wrong command line arguments
- Significantly changed the way postgres compatibility tests are run. The user used
no longer needs super user permissions on the database (just createdb, dropdb),
but thecreatedb
/dropdb
tools must now also be in$PATH
. - Added P versions of the
Exec
/Query
functions.