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: EXPOSED-82 Inaccurate UShort column type mapping #1799

Merged
merged 4 commits into from
Jul 28, 2023

Commits on Jul 27, 2023

  1. fix: EXPOSED-82 Inaccurate UShort column type mapping

    Currently, when attempting to insert a UShort value outside of the range [0, 32767],
    Exposed truncates the value by calling value.toShort() before sending it to the
    DB, causing overflow. The value is stored successfully as a negative number because
    all databases (except MySQL and MariaDB) don't support unsigned types natively,
    which means Exposed is actually mapping to 2-byte `SMALLINT`, which accepts
    the range [-32768, 32767].
    
    Change the default mapping to the next higher-up integer data type INT (technically
    a 4-byte storage type) and remove the truncation conversions so that an accurate
    value is sent/received to/from the database. To ensure that the intended behavior
    cannot be overriden using exec() directly, a check constraint is auto-applied to
    the column when registered if the database is not MySQL/MariaDB.
    
    Oracle INT is an alias for NUMBER(38), so this has been overriden to a reduced
    type NUMBER(6).
    bog-walk committed Jul 27, 2023
    Configuration menu
    Copy the full SHA
    66af383 View commit details
    Browse the repository at this point in the history
  2. fix: EXPOSED-82 Inaccurate UShort column type mapping

    Add regression unit test for UShort column type
    bog-walk committed Jul 27, 2023
    Configuration menu
    Copy the full SHA
    b0a2fd3 View commit details
    Browse the repository at this point in the history
  3. fix: EXPOSED-82 Inaccurate UShort column type mapping

    Edit KDocs to use UShort.MAX_VALUE instead of number.
    
    Fix regression test.
    bog-walk committed Jul 27, 2023
    Configuration menu
    Copy the full SHA
    810e793 View commit details
    Browse the repository at this point in the history

Commits on Jul 28, 2023

  1. fix: EXPOSED-82 Inaccurate UShort column type mapping

    Rename regression test more appropriately.
    bog-walk committed Jul 28, 2023
    Configuration menu
    Copy the full SHA
    74c4b3a View commit details
    Browse the repository at this point in the history