





create table boolean (
id integer primary key,
name text not null unique
)
insert into boolean (name) values ('true');
insert into boolean (name) values ('false');
create table document (
id integer primary key,
name text not null unique,
body text not null,
is_archived not null integer,
foreign key (is_archived) references boolean (id)
on delete cascade
on update no action
);
Solved.
Bonus: DBAs hate this one weird trick that can free up incredible amounts of disk space by deleting just two rows.
That on delete cascade is evil. I love it.
Would this make 0 = true and 1 = false?
You’re right, that’s way too simple. Definitely need to rotate the booleans daily. For… security. Yeah, security.

I think you got the wrong caption. It’s the world if SQLite supported multiple concurent writes.
Stupid transaction deadlocks…
In my case, I want to use sqlite locally, for development, but I don’t want to add a load of jank to handle booleans for sqlite.
I use rust’s SQLx which map bools to numbers so it must be a problem with your connector maybe
Yeah I should probably open an issue.
username checks out
so it must be a problem with your connector maybe
or with their programming language
I actually started using rust well after picking this username :P
This is sqlite’s intended use case. To replace configure files and local data
What do you use instead of booleans ? floats ?
strings “true” and “false” ofc like any sane developer
I got a better one: O for true and N for false.
Seen in production for quite important stuff (payment requests).
O is from Oui, N from Non, of course!
😐🫤
This is awful and aweful at the same time.
Non affective, non effective.
The system I work on uses “Y” and “N”.
good fucking god
it allows for mood changes, some parts of the code can check charAt(0) == 't'others can do val != 'false' just let it flow.
lord mary joseph make it stop
And for double fun if the output doesn’t matter you can make if endsWith(“e”).
Use a CHAR(1) you can then use it as an enumeration.
Don’t use T/F for true/false use it for the actual sematic meaning for the thing that the Boolean is toggling. E g. S for subscribed, U for unsubscribed, or whatever.
It also means when you inevitably grow to needing a tri-state it makes sense.
Unless SQLite actually supports enumerations, then just use them
I think you could use a CHECK constraint to effectively create en enum
Sometimes it’s 0 and 1
If it just supported sorting by random with a seed…
But that’s IFF.