Open Shaglock opened 2 weeks ago
Actually I figured out the issue myself.
Test db uses same configuration as development (storage/<%= Rails.env %>-cache.sqlite3
).
Changing database names for test environment fixed the problem.
diff --git a/config/database.yml b/config/database.yml
index 49fc1b3..0c42d6d 100644
--- a/config/database.yml
+++ b/config/database.yml
@@ -39,10 +39,15 @@ test:
primary:
<<: *default
database: storage/test.sqlite3
- queue: *queue
- cache: *cache
- cable: *cable
-
+ queue:
+ <<: *queue
+ database: storage/test-cable.sqlite3
+ cache:
+ <<: *cache
+ database: storage/test-cache.sqlite3
+ cable:
+ <<: *cable
+ database: storage/test-queue.sqlite3
# SQLite3 write its data on the local filesystem, as such it requires
# persistent disks. If you are deploying to a managed service, you should
@fractaledmind Do you have any other suggestions to fix the issue? If not, maybe the defaults should be changed to avoid this issue?
Describe the bug Maybe I am doing something wrong, but after running the template generator (
bin/rails app:template LOCATION=https://raw.githubusercontent.com/fractaledmind/enlitenment/main/template.rb SKIP_LITESTREAM=true SKIP_SOLID_ERRORS=true INSTALL_INTO=application
), I am trying to make a new model and dorails db:migrate
and then reset the db withrails db:reset
I get the error:Running the same command with `--trace`
To Reproduce
Minimal reproduction I was able to do:
rails new reproduction-enlitement
cd reproduction-enlitement/
rails db:migrate
rails db:setup
bin/rails app:template LOCATION=https://raw.githubusercontent.com/fractaledmind/enlitenment/main/template.rb SKIP_LITESTREAM=true SKIP_SOLID_ERRORS=true INSTALL_INTO=application
rails db:reset
(first time it seems to work fine)rails db:reset
bin/rails db:environment:set RAILS_ENV=development
to fix this issue, but it doesn't helpExpected behavior No issues with doing
rails db:reset
multiple timesAdditional context Using rails 7.2.1, ruby 3.3.5.
I also noticed rails by default has
sqlite3
gem version>= 1.4
while in this template it's~> 2.0
, and running the template doesn't update the gem. However I tried to update it manually and did NOT affect anything at all.I also noticed when running reset for the first time it seems to try to do the same thing multiple times for some reason (delete and create cache\queue\cable dbs twice), not sure if that's related