• TootSweet@lemmy.world
    link
    fedilink
    English
    arrow-up
    62
    arrow-down
    2
    ·
    4 months ago
    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.

  • RustyNova@lemmy.world
    link
    fedilink
    arrow-up
    49
    ·
    4 months ago

    I think you got the wrong caption. It’s the world if SQLite supported multiple concurent writes.

    Stupid transaction deadlocks…

      • RustyNova@lemmy.world
        link
        fedilink
        arrow-up
        14
        ·
        4 months ago

        I use rust’s SQLx which map bools to numbers so it must be a problem with your connector maybe

      • nilloc@discuss.tchncs.de
        link
        fedilink
        English
        arrow-up
        7
        ·
        4 months ago

        That’s what I like about Ruby ORMs. They did all the conversion for you, and you could have SQLite on your dev box, Postgres on the test server and MySQL on the annoying production host that wouldn’t run anything else.

        This was 18 years ago though.

    • dan@upvote.au
      link
      fedilink
      arrow-up
      3
      ·
      4 months ago

      WAL mode makes writes a lot faster, which is sufficient for a bunch of use cases. Writers do still need to wait, but they have to wait for a shorter duration. It’s still not the right choice for write-heavy use cases, of course.

      • RustyNova@lemmy.world
        link
        fedilink
        arrow-up
        2
        ·
        4 months ago

        I’m not actually looking for the speed most of the time, but more about preventing partial writes, so I’m still using it

  • lambisio@feddit.cl
    link
    fedilink
    English
    arrow-up
    3
    ·
    4 months ago

    I can live without Booleans I think… what saddens me more than nothing else is the lack of more proper treatment for Decimal-like types.