Commit graph

63 commits

Author SHA1 Message Date
Aaron L
711ecbbe8d Use pg-specific schema tables for fkey detection
- Postgres doesn't care about names for uniqueness of keys unlike mysql
  because internally it keeps "oid" values to keep track of everything.
  Unfortunately this means that the information_schema standard is
  inadequate to differentiate between constraints that are named the
  same (which isn't possible in mysql, but is in pg). Hence we have to
  dip into the pg specific schemas for better or worse.
- Fix naming of the sample schema in the README since it would fail for
  mysql due to duplicate naming.
- Mark test schema up so we don't fix the bad names so we catch
  regressions here.
- Fix #85
2017-01-06 17:53:10 -08:00
Aaron L
14b9122a08 Fix underspecification of constraint lookups. 2017-01-03 20:29:43 -08:00
Aaron L
5f7bee14a0 Relax the definition of unique on columns (psql)
- Fix formatting on giant postgres query
- Invert the section that looks for unique constraints to look for a
  constraint and join to the constraint_column_usage to be more in line
  with the mysql query and also it makes a little bit more sense.
- Add more checks to ensure the schema is being enforced in the postgres
  side of things as several pieces in the unique checks were missing it
  which would lead to false positives.
- Fix #77 for postgres
2017-01-03 19:43:01 -08:00
Aaron L
23b6221f8b Relax the definition of unique on columns (mysql)
- Fix #77
2017-01-03 19:11:15 -08:00
Patrick O'brien
dea748d409 Add --tinyint-as-bool flag (v2.1.4 release) 2017-01-02 15:16:08 +10:00
Aaron L
ca748b070d Merge branch 'dev' 2016-11-12 00:08:09 -08:00
Patrick O'brien
86ca3bbcea Fixed import paths for null package, add byte typ 2016-11-12 12:02:44 +10:00
Aaron L
ede97dea5b Add enum const generation
- Make postgres name its enums
- Add way to filter columns by whether or not they're an enum
- Split parsing of enums into name & values
- Add strmangle check functions: IsEnumNormal, ShouldTitleCaseEnum
- Add new strmangle enum functions to template test
- Implement a set type called "once" inside the templates so that we can
  ensure certain things only generate one time via some unique name.
2016-11-11 01:06:30 -08:00
Aaron L
cb6de17ea6 Add driver support for enums 2016-11-09 23:06:09 -08:00
Patrick O'brien
a25e3589e6 Make warnings for incompat data type readable 2016-10-16 19:37:28 +10:00
Sven
bb5f3a4e6f mysql driver: query only base tables 2016-10-11 08:27:24 +02:00
jseriff
b0182bead7 Fix cross schema constraints issue
Query was not properly joining on both name and schema.  This will fix the issue where a constraint exists across multiple schemas and causes duplicate relationships to be created.
2016-09-26 12:16:42 -05:00
Patrick O'brien
fdeecbf106 Fix insert and randomize errors, fix time.Time
* MySQL requires timeParsing enabled
* Update readme to reflect this requirement
2016-09-19 15:22:32 +10:00
Patrick O'brien
40ce5838f3 Fix hstore naming 2016-09-15 16:58:41 +10:00
Aaron L
468e2f9ad3 Fix default values in mysql driver 2016-09-13 00:28:00 -07:00
Patrick O'brien
9bcaf51493 Fix randomize for all array types, remove generic
* GenericArray can't work with generated code.
* Multi-dimensional arrays can't work because
  PSQL does not have a method to discover array
  depth.
2016-09-12 07:22:17 +10:00
Patrick O'brien
e62dfe369f Add array types and hstore types 2016-09-12 03:40:59 +10:00
Patrick O'brien
793522650c Add lq, rq, and indexplaceholders args everywhere 2016-09-10 05:15:50 +10:00
Patrick O'brien
419f2760c7 Change quotes to bytes 2016-09-10 03:30:46 +10:00
Patrick O'brien
9e6a3d5ee3 Add quote dialects 2016-09-10 03:14:18 +10:00
Patrick O'brien
51b4f9b309 Fix superfluous arg to placeholders 2016-09-09 17:57:01 +10:00
Aaron L
aadcf63e52 Fix problem with mysql table query. 2016-09-08 23:04:33 -07:00
Aaron L
1e0b90a99c Fix problem with table lookup in postgres 2016-09-08 22:42:49 -07:00
Aaron L
16b6a2b176 Rename Exclude -> Blacklist 2016-09-08 22:41:57 -07:00
Aaron L
97d6636da4 Add a MySQL driver 2016-09-08 22:22:28 -07:00
Aaron L
0eac708c56 Fix bad SQL parameterization 2016-09-08 20:48:22 -07:00
Aaron L
6224b1c463 Move globals away so we can make mysql driver 2016-09-08 20:41:50 -07:00
Patrick O'brien
1c8a9d2e39 Add schema feature to everything (except rels)
* Add strmangle SchemaTable helper
2016-09-09 07:23:10 +10:00
Patrick O'brien
5300a0f6a4 Fix all postgres types, fix all randomize types 2016-09-09 00:35:43 +10:00
Patrick O'brien
757cbde016 Add NullJSON and JSON types, fix randomize struct 2016-09-08 19:07:33 +10:00
Patrick O'brien
ce8573eccd Updated to null.v5, update postgres driver types 2016-09-07 23:50:54 +10:00
Patrick O'brien
7144d272bd Add whitelist feature 2016-09-06 00:41:12 +10:00
Patrick O'brien
9b0cfc2901 Fix more typos in comments 2016-09-05 21:28:58 +10:00
Aaron L
6c742e29e9 Fix more broken code 2016-08-27 17:04:51 -07:00
Aaron L
113f8be521 Correct tests 2016-08-23 23:28:49 -07:00
Aaron L
28e485603a Add fast path for binding by caching TitleCase 2016-08-23 23:20:41 -07:00
Patrick O'brien
54c739ba97 Update mock and tests to use better tables 2016-08-23 13:39:10 +10:00
Patrick O'brien
22a904d025 Convert sqlboiler tests to MockDriver
* Improve impl of mock driver
2016-08-18 22:11:49 +10:00
Patrick O'brien
8d0cd2a53d Move fakeDB to MockDriver in drivers package 2016-08-18 15:26:24 +10:00
Patrick O'brien
1e67965482 Add exclude/blacklist tables flag 2016-08-16 20:38:31 +10:00
Aaron L
81433cfaf4 Not freeing rows objects. 2016-08-14 18:36:22 -07:00
Patrick O'brien
75e28d3f5b Refactor RandomizeField
* Fix randomize arg in relationship helper
* Fix param name for RandomizeStruct
2016-08-15 01:32:57 +10:00
Aaron L
944303f2f5 Properly abstract LastInsertID 2016-08-13 16:34:02 -07:00
Aaron L
5360d3094e Use errors package all over the project
In general:
errors.New("thing") -> errors.New
fmt.Errorf("thing %s", arg) -> errors.Errorf
fmt.Errorf("thing %v", err) -> errors.Wrap
fmt.Errorf("thing %s %v", arg, err) -> errors.Wrapf
2016-08-13 11:37:16 -07:00
Patrick O'brien
d92a439c54 Modify postgres query to get is_unique for indexes
* Remove unused SnakeCase function
* Fix formatting bug in relationship structs
2016-08-13 17:30:55 +10:00
Patrick O'brien
33286e648a Update repo to add vattle org paths 2016-08-09 17:59:30 +10:00
Patrick O'brien
afedc92224 Change Enforced to Validated 2016-08-03 14:22:32 +10:00
Patrick O'brien
c7c0fe5c0d Add provision for enforced types, eg uuid
* Add enforced to column data
* Add enforced list to driver
* Fix bug in TitleCase (now uses regexp)
* Fix broken zero-value enforced type inserts by using RandomizeEnforcedStruct
2016-08-03 12:05:05 +10:00
Patrick O'brien
39fe91f2cb Add RandomizeEnforcedStruct
* Fix broken Select QM test
2016-08-03 10:53:34 +10:00
Aaron L
1cb57741cf Change default ints to int not int32
- THANKS PATRICK
2016-07-31 22:50:33 -07:00