mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-23 01:14:31 +02:00
Use REAL for floating point columns if table is strict, closes #644
Refs #645
This commit is contained in:
parent
7423296ec7
commit
4dc2e2e9c8
4 changed files with 17 additions and 3 deletions
|
|
@ -938,10 +938,15 @@ class Database:
|
|||
other_column=foreign_keys_by_column[column_name].other_column,
|
||||
)
|
||||
)
|
||||
column_type_str = COLUMN_TYPE_MAPPING[column_type]
|
||||
# Special case for strict tables to map FLOAT to REAL
|
||||
# Refs https://github.com/simonw/sqlite-utils/issues/644
|
||||
if strict and column_type_str == "FLOAT":
|
||||
column_type_str = "REAL"
|
||||
column_defs.append(
|
||||
" [{column_name}] {column_type}{column_extras}".format(
|
||||
column_name=column_name,
|
||||
column_type=COLUMN_TYPE_MAPPING[column_type],
|
||||
column_type=column_type_str,
|
||||
column_extras=(
|
||||
(" " + " ".join(column_extras)) if column_extras else ""
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue