Skip to content

Commit

Permalink
forcing decimal definition for non JSON table LINST instruments
Browse files Browse the repository at this point in the history
  • Loading branch information
regisoc committed May 23, 2024
1 parent 6ae696b commit ba1c769
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tools/generate_tables_sql.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@
case "radio":
$bits[0] = enumizeOptions($bits[3], $table = [], $bits[1]);
break;
case "numeric":
// without this option, default MySQL is simply numeric
// which is traduced to "decimal(10,0)"
// which truncates the floating point part.
$bits[0] = "decimal(14,4)";
break;
case "select":
$bits[0] = enumizeOptions(
$bits[3] ?? null,
Expand Down
5 changes: 5 additions & 0 deletions tools/generate_tables_sql_and_testNames.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@
$bits[0] = "varchar(255)";
} elseif ($bits[0] == "static") {
$bits[0] = "varchar(255)";
} elseif ($bits[0] == "numeric") {
// without this option, default MySQL is simply numeric
// which is traduced to "decimal(10,0)"
// which truncates the floating point part.
$bits[0] = "decimal(14,4)";
}

$output .= "`$bits[1]` $bits[0] default NULL,\n";
Expand Down

0 comments on commit ba1c769

Please sign in to comment.