* Adding ability to use MySQL DEFAULT clause
Adding mysql.default option and documentation on special case for date.
Adding unit tests for Default Clause.
* Handle unsupported types, don't stringify numbers
* Adding note about unsupported column types.
* Update readme.
Since using REPLACE or INSERT...ON DUPLICATE KEY
statements both give us affected rows of 1 for a
new row or a row which got updated with the same
values, we make isNewInstance undefined on after
save hook for save, replaceOrCreate, and
updateOrCreate methods. Also, disable juggler
tests for that functionality.
When converting null values
to database column values,
return null if column is
nullable, otherwise try
to cast it to the property
type, and if not, return
'null'.
MySQL expects reverse order of latitude and longitude
from the way we use it in LoopBack, so switch the order
when saving and loading Point spatial type we use for
Point/GeoPoint.
* fix compare of foreign keys for autoupdate
use mysql table name in case it is not equal model name
* fix column name lookup for fk definition
* fix ADD CONSTRAINT for multiple fk
if more the one foreign key added ADD CONSTRAINT
must be separated with comma but not with space as applySqlChanges do.
* fix duplicate foreign key creation on autoupdate
* fix entity name selection
* change join to toString as requested
* fix removing dropped keys
* fix linter issues
* add test case with columnName in foreign key
and isActual check after autoupdate
* uncommit accitenally commited test case
This commit contains all previous work after rebase went badly
RE: Pull Request requested by @kjdelisle regarding #149 following my
proposed solution "A" at #149 (comment).
As mentioned in the post linked above, this change allows the
underlying mysqljs/mysql module to handle Date object serialization
and removes the forced conversion of Dates to UTC Strings.
An opt-out fallback to forced coercion to UTC is included,
which was modeled after #265 from @darknos .
Old, squashed commits:
d0ea1d926eae04d0355109c87eef4eeec173f887
Legacy UTC date processing fallback credit: @darknos
a59dad7d7bd945895fb410a963cf5932b6a20f9e
Remove orphaned string functions
e8fdbdcfd4092f3d9e018f688d14def3e3ca9856
Incorporate @darknos expanded check for zero dates
abd4e0a7e9122f857974678a6b6ad87a19988f6f
Remove DATE manipulations in from/toColumnValue
* refactor date, timestamp, datetime data-type
* reverse datatypes.test.js changes
* checking property.mysql.dataType
along with property.dataType for timestamp fields
* Fix PR linter
* moved test cases all under one test file
remove unnecessary test cases, unify setup procedures
* Fix sql mode before migration
Set sql mode to allow zero's on timestamp
Clean up code
* remove test cases with strings and DATE field type
* code cleanup as requested
* add accidentally deleted assert.ok(found)
* fix timeZone to timezone case in README.md
* Update readme with date type info
Include fk with autoupdate/migrate
Some tests are failing due to timeout, looking into it
should check actuality of dataSource fails, looking into it
Fix actuality of ds test
Fix autoupdate test timeout
Fix requested changes
Fix to checkOnly for isActual
* Return if column is generated or not
Related to
https://github.com/strongloop/loopback-datasource-juggler/issues/899
* add pk for testgen table
* Fixe the double quotes around generated
as requested by @loay
* Fix commit linter
Block must not be padded by blank lines padded-blocks
* Code fixes to follow guide
* Should fix the tests failing
Test failing on the tableName (incorrect case)
Fix timeout error on tests
Signed-off-by: Sakib Hasan <sshasan10@hotmail.com>
add showFields and showIndexes functions
Extract getTableStatus
Extract columnDataType to base connector
Updated the autoupdate function so that it collects foreign key
statements and runs them once all tables have been updated.
This prevents foreign keys being created before referenced tables.
Since alterTable is semi-public, the method now checks the arugments to
make sure that it still supports the old signature that doesn't include
actualFks
Per http://dev.mysql.com/doc/refman/5.7/en/numeric-type-overview.html
`BOOL` and `BOOLEAN` is alias for `TINYINT(1)` thus we should make
sure discover can handle as such.
Introducing three flags:
* treatCHAR1AsString
default false - treats CHAR(1) as a String instead of a Boolean
* treatBIT1AsBit
default true - treats BIT(1) as a Boolean instead of a Binary
* treatTINYINT1AsTinyInt
default true - treats TINYINT(1) as a Boolean instead of a Number
The default handling for CHAR(1) is legacy backward compability due to
custom to use a CHAR(1) to store 'Y', 'N', '0', '1', etc...