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'.
* 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
* 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
* 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)
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.
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...
Fix mysql column name being ignored on dataType change or new column
being added
Fix mysql column name ignored if index changed
Add column name case on autoupdate test
Fix test case scheme error
Fix describe test
* TEST_ prefix is not used by CI anymore and there for serve no purpose
* Part of overall goal to standardize env var injection to
MODULE_VARNAME (ie. MYSQL_HOST for example) convention
Environment variables set in pretest.js and test/init.js were silently
being converted to Strings. For example, when TEST_MYSQL_USER is
undefined, it's value was automatically converted to the String
'undefined'. This is documented a side effect of assigning values to
process.env. See https://nodejs.org/api/process.html#process_process_env
for more details
Index cardinality is actually a metric that is based on MySQL analyzing
the table contents, so its value here has more to do with whether the
tests are running against a new table, an old table, or whether it has
any data in it.
The Sub_part field is similarly unimportant for the purposes of these
tests since it refers to indexing internals based on data type and
partial indexing.
See: https://dev.mysql.com/doc/refman/5.5/en/show-index.html
Allow the tests to run on ci.strongloop.com using the credentials that
are given there, but translate them to the form that is used on
cis-jenkins, which is actually the correct format.
If no password is given, '+ password' stringifies to 'undefined', which
generates a URL that has 'undefined' as the password instead of leaving
out the password.
Per MySQL docs
(http://dev.mysql.com/doc/refman/5.7/en/date-and-time-types.html):
"MySQL permits you to store a “zero” value of '0000-00-00' as a
“dummy date.” This is in some cases more convenient than using NULL
values, and uses less data and index space. To disallow '0000-00-00',
enable the NO_ZERO_DATE mode.
“Zero” date or time values used through Connector/ODBC are converted
automatically to NULL because ODBC cannot handle such values."
As we are not using Connector/ODBC we need to handle this ourself.