So our boolean columns default to t&f instead of 1&0. This is probably a legacy way of storing boolean in sqlite.
and
sqlite3 db.sqlite "SELECT DISTINCT admin from subscriptions;"tf
After we applied the fix on one list
schleuder-cli subscriptions set foo@bar.org admin falseschleuder-cli subscriptions set foo@bar.org admin true
I get:
sqlite3 db.sqlite "SELECT DISTINCT admin from subscriptions;"1 <---- !!!ft
So it looks like after the upgrade we use a newer sqlite-adapter, that is not as forgiving with BOOLEAN values stored as 't' and 'f' in a column in sqlite3.
I was on this path of research yesterday night, because the problem rang a distant bell, but didn't come up with anything. Thank you so much for debugging this!
(Found via the implementing pull request: https://github.com/rails/rails/pull/29699). We missed this breaking change because it is not mentioned in the Rails' Upgrading Guide, and the Rails' Changelog doesn't highlight breaking changes at all. Sorry to everyone who has to deal with these consequences.
I'm using raw SQL because I'm not sure how to use ActiveRecord-tooling with a schleuder-installation from deb-packages. E.g. where would I put rake-tasks or migrations?? Or what classes do I require from where...
This is why the instructions linked here:
ExampleModel.where("boolean_column = 't'").update_all(boolean_column: 1) are not really working for me.
But I think scripting the adjustments in SQL is a feasible way to get this over with.
Where I'm stuck now is the wrong default values for the boolean columns.
First observations: in our db the subscriptions-table has default values 'f' & 't'.
But the lists table with the many boolean switches for the lists already has 0 & 1 as default values. The actual values in the columns are still t&f and need to be corrected.
Since sqlite3 does NOT support changing columns default values at all,
the advice is to
create NEW table with identical columns and correct default values
copy over all values
remove the OLD table with the wrong default values
rename the NEW table to the original table name
To avoid all this hassle I tried .dump-ing the db into a text file,
end the edit
I don't know how they do it (didn't find the code), but on my machine™ it works (Archlinux with gems ActiveRecord v6.1.3, sqlite v1.4.2). Could you try this in your setup?
To change the values you could still use Ruby code with a temporary class in order to avoid problems like we did here. A migration should be runnable on Debian like on any other setup (rake db:migrate). If that isn't the case, our Debian specialist maybe can help but they are afk for some days.
But I guess using SQL should be ok in this simple case, too.
Thanks for the suggestions. But I am still stuck on how to access schleuder console on a debian install.
I figured out, that I probably have to move to /usr/lib/ruby/vendor_ruby/schleuder fist.
But rake -T only gives me all the db:tasks. Looking at /usr/lib/ruby/vendor_ruby/schleuder/Rakefile I kinda understand, why they are available there. But there is not rake colsole available. Should it?
After having a deeper look into this, I'm wondering if, instead of handling database migrations, which are a sensible way to fix this issue, but also more complex and error-prone, way more easy, but also hacky (?), would be to monkey patch the actual ActiveRecord connection adapter to handle SQLite3 to tell it what it needs to do, for example, via:
To me, this issue seems database-specific, because, AFAIK, PostgreSQL is able to handle the values as is. I'm aware of people considering moving their Schleuder databases off SQLite3 towards PostgreSQL. So what about staying with database values which are still accepted, and handled correctly, in the wider ecosystem?
On a site note, do I understand this correctly that schleuder supports postgresql? i only saw sqlite dependencies in there and i don't remember the docu saying that postgresql is a thing
On a site note, do I understand this correctly that schleuder supports postgresql? i only saw sqlite dependencies in there and i don't remember the docu saying that postgresql is a thing
georgchanged title from "List has no admin configured" - can't send mails after upgrade to 3.6 to ActiveRecord >= 6.0 represents boolean values as integers by default, breaks upgrades 3.x -> 4.x
changed title from "List has no admin configured" - can't send mails after upgrade to 3.6 to ActiveRecord >= 6.0 represents boolean values as integers by default, breaks upgrades 3.x -> 4.x
georgchanged title from ActiveRecord >= 6.0 represents boolean values as integers by default, breaks upgrades 3.x -> 4.x to ActiveRecord >= 6.0 represents boolean values as integers by default, leads to errors after upgrade
changed title from ActiveRecord >= 6.0 represents boolean values as integers by default, breaks upgrades 3.x -> 4.x to ActiveRecord >= 6.0 represents boolean values as integers by default, leads to errors after upgrade
georgchanged title from ActiveRecord >= 6.0 represents boolean values as integers by default, leads to errors after upgrade to ActiveRecord SQLite3 >= 6.0 represents boolean values as integers by default, leads to errors after upgrade
changed title from ActiveRecord >= 6.0 represents boolean values as integers by default, leads to errors after upgrade to ActiveRecord SQLite3 >= 6.0 represents boolean values as integers by default, leads to errors after upgrade
Is this only an issue during upgrading or also for clean schleuder 4 installations?
This only applies to upgrades which involve ActiveRecord < 6.0 to >=
6.0. In case you're asking wrt the ArchLinux context, if there only ever
was the later in place, since Schleuder is (again?) available, this
shouldn't be of concern.