kysely icon indicating copy to clipboard operation
kysely copied to clipboard

SQLite STRICT tables

Open nikeee opened this issue 1 year ago • 0 comments

SQLite has STRICT as a table option : https://www.sqlite.org/stricttables.html

Without STRICT:

CREATE TABLE t1(a ANY);
INSERT INTO t1 VALUES('000123');
SELECT typeof(a), quote(a) FROM t1;
-- result: integer 123

With STRICT:

CREATE TABLE t1(a ANY) STRICT;
INSERT INTO t1 VALUES('000123');
SELECT typeof(a), quote(a) FROM t1;
-- result: text '000123'

Is it possible with kysely without using some raw SQL?

db.scheme.createTable("t1").strict() doesn't seem to exist.

There is also WITHOUT ROWID, but this miht not be used that much. Strict tables however are considered as the default way of creating a table for a lot of people.

nikeee avatar Jul 25 '24 13:07 nikeee