Commit graph

128 commits

Author SHA1 Message Date
Alex Grintsvayg
ed423a3606 detect autoincrement column, fix lastID in upsert when update doesnt change anything 2017-06-12 14:02:04 -04:00
Alex Grintsvayg
912a689701 added unique key detection (mysql only for now), improved merging 2017-05-12 06:56:48 -04:00
Alex Grintsvayg
451723ccb9 fix imports to point at lbryio repo 2017-05-08 13:25:15 -04:00
Alex Grintsvayg
1467b88f04 detect unsigned int columns in mysql 2017-05-08 13:10:21 -04:00
Aaron L
112a836af2 Make UDT's that aren't enums fall through
- This allows typse that are not enumerations to properly escape the
  enumeration code in the query.
- Fix #131
2017-04-28 21:07:39 -07:00
Sergey Kurt
4560da9bd1 Fixed comment for TableNames 2017-04-02 12:48:29 +03:00
Sergey Kurt
a4ba4b6e9d Uniqueidentifier now treated as uuid 2017-03-31 11:39:12 +03:00
Sergey Kurt
874d2ed2e6 Fixed type for non-nullable uniqueidentifier, xml 2017-03-31 11:24:11 +03:00
Sergey Kurt
68ac8a3c34 Disabled UseLastInsertID in favor of query output params 2017-03-19 18:05:55 +03:00
Sergey Kurt
12dce9d986 Auto columns in Inserts removed 2017-03-19 12:42:55 +03:00
Sergey Kurt
a508530f63 Allow UseLastInsertID 2017-03-19 12:39:59 +03:00
Sergey Kurt
ccb0c9f6c8 Missed placeholder 2017-03-18 16:22:31 +03:00
Sergey Kurt
8874738f73 Fixed query formatting 2017-03-18 15:40:17 +03:00
Sergey Kurt
f3f8074833 Removed blank lines and spaces 2017-03-18 15:18:04 +03:00
Sergey Kurt
4718e72b6d Idiomatic quotes 2017-03-16 11:43:51 +03:00
Sergey Kurt
2e9535d56e Added uniqueidentifier and xml types (as string) 2017-03-16 11:29:31 +03:00
Sergey Kurt
e943c37a99 Update and Insert only for columns without autogenerated 2017-03-16 10:26:05 +03:00
Sergey Kurt
6fad1bd148 Added column flag for autogenerated values like IDENTITY | TIMESTAMP | ROWVERSION 2017-03-15 15:31:09 +03:00
Sergey Kurt
705befef07 Fixed types mapping 2017-03-15 14:12:21 +03:00
Sergey Kurt
85fc6e546a Fixed float and real mapping 2017-03-14 18:49:40 +03:00
Sergey Kurt
6aadf439c9 Fixed column types mapping 2017-03-14 18:45:41 +03:00
Sergey Kurt
5d72569635 Fixed Insert and Select for timestamp, rowversion 2017-03-14 18:06:12 +03:00
Sergey Kurt
0bdbee86f1 Queries refactoring 2017-03-14 14:58:32 +03:00
Sergey Kurt
e3254c1851 Allow MS SQL driver to use indexed placeholders 2017-03-14 14:01:53 +03:00
Sergey Kurt
454a3a816a Fixed quote symbols 2017-03-14 13:46:35 +03:00
Sergey Kurt
cbdbe4891a MSSQL rows limit/offset via TOP or OFFSET ... FETCH NEXT ... ROWS 2017-03-14 11:13:56 +03:00
Sergey Kurt
b4c9af72e7 Correct quote symbols 2017-03-13 16:28:23 +03:00
Sergey Kurt
2d3983b992 Bit and tinyint data types support 2017-03-13 16:27:16 +03:00
Sergey Kurt
e00ea60679 Initial MSSQL support 2017-03-13 12:55:26 +03:00
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
Aaron L
5eb14f262a Add function to check LastInsertId-ability
- Previously we used a lot of template magic to see if we could
  use LastInsertId. But there's a much simpler check that's worth doing,
  do this at the table level and then let it fall through.
2016-09-24 15:58:37 -07:00
Aaron L
66dbe6a74c Fix erroneously flagged join tables 2016-09-22 00:21:12 -07:00
Aaron L
d3b734d29b Remove COMPLETELY unused code 2016-09-22 00:21:12 -07:00
Aaron L
14c5e5f149 Fix generation of self many-to-many
- Clean up the generation of to_many relationship types
2016-09-22 00:21:12 -07: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
Aaron L
8b60b97b9f Un-invert the logic in relationships.go 2016-09-18 16:10:20 -07:00
Aaron L
b918e9ef9e Isolate to_many from one_to_one in bdb 2016-09-17 23:11:50 -07:00
Aaron L
afe2665e52 Clean up the bytes checks with text helpers 2016-09-17 00:02:03 -07:00
Patrick O'brien
40ce5838f3 Fix hstore naming 2016-09-15 16:58:41 +10:00