Replies: 1 comment 1 reply
-
I converted this to a discussion as this is a feature request and not a bug report. This is just how the feature is currently supposed to work. Any additional configuration to change this would be a new feature. As for your suggestions:
For the reasons you already described I would rather try to avoid adding more such specific config flags.
It's not clear that this is the right solution for everyone. There are use-cases that might want to use 32-bit integers for whatever reason.
Does SQLite actually guarantee that for STRICT tables?
If you have suggestions that don't involve re implementing a SQL parser we can certainly talk about this. That said this still wouldn't mean that using the I believe the right way to address this is to make the type mapping much more configurable via the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Setup
Versions
Feature Flags
returning_clauses_for_sqlite_3_35
,sqlite
Problem Description
This issue is similar to #852 but applies to all
INTEGER
fields.I have 2 STRICT tables:
Due to
STRICT
table restrictions I can't useBIGINT
as a data type, onlyINTEGER
andINT
are available.In Sqlite
INTEGER
corresponds to an up to 64bit integer, butdiesel print-schema
maps it toi32
.What are you trying to accomplish?
print-schema
automatically.STRICT
. This helps me prevent bad database modifications.What is the expected output?
What is the actual output?
Are you seeing any additional errors?
No.
Steps to reproduce
The generated schema is bad for the following reasons:
files::update_id
isInteger
, butupdates::id
is BigInt.--sqlite-integer-primary-key-is-bigint
both fields will beInteger
.BIGINT
together withSTRICT
.Possible solutions
sqlite_integer_is_bigint
(and possiblysqlite_implicit_not_null_primary_keys
)This is similar to #3940, allows the most flexibility.
The downside is discoverability and the need to set up all these compatibility flags. Now will be 3, maybe other people will find more.
sqlite_strict_tables
flagInstead of creating a multitude of flags per behaviour, just assume if a user uses
STRICT
tables, all of their tables areSTRICT
. And apply the changes accordingly:diesel::BigInt
forINTEGER
.Nullable
for primary keys.Figure out a way to detect
STRICT
tablesI understand your concern about implementing an SQL parser, I don't have a good suggestion how to detect
STRICT
reliably.pragma table_info
isn't helpful.Summary
BIGINT
in the Sqlite schema because ofSTRICT
.BigInt
for primary keys, butInteger
for foreign keys.STRICT
schema andprint-schema
flags that would generate a good schema.Checklist
closed if this is not the case)
Beta Was this translation helpful? Give feedback.
All reactions