Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "current_timestamp(6)" !== "CURRENT_TIMESTAMP(6)" for MariaDB >= 10.2 #4783

Merged
merged 1 commit into from Oct 18, 2019

Conversation

jeremija
Copy link
Contributor

@jeremija jeremija commented Sep 19, 2019

Fixes #4782. I've explained the issue in great detail there.

  • Fixed a check for CURRENT_TIMESTAMP, and made it more generic to cover cases like CURRENT_TIMESTAMP, CURRENT_TIMESTAMP() and CURRENT_TIMESTAMP(6), ignoring the case.
  • Fixed a test failure in test/functional/query-builder/add-column.ts due to double-quoting:
    column2!.default!.should.be.equal("'this is description'");
  • Added semver dependency to make it easy to check the version of MariaDB.

@jeremija jeremija changed the title Issue 4782 Fix "current_timestamp(6)" !== "CURRENT_TIMESTAMP(6)" for MariaDB >= 10.2 Sep 19, 2019
Added VersionUtils module to make it easier to compare coerce and
compare versions of MariaDB database.

See https://mariadb.com/kb/en/library/information-schema-columns-table/

Relevant excerpt for `COLUMN_DEFAULT`:

> Default value for the column. From MariaDB 10.2.7, literals are quoted
> to distinguish them from expressions. NULL means that the column has no
> default. In MariaDB 10.2.6 and earlier, no quotes were used for any type
> of default and NULL can either mean that there is no default, or that
> the default column value is NULL.
const v1 = parseVersion(version);
const v2 = parseVersion(targetVersion);

return v1[0] > v2[0] ||
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adding "(" ")" would really simplify understanding of this code

@pleerock pleerock merged commit c30b485 into typeorm:master Oct 18, 2019
@pleerock
Copy link
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants