summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-08-09 22:14:29 +0200
committererdgeist <erdgeist@erdgeist.org>2026-08-09 22:14:29 +0200
commit8135e08107f81c38389ec3938df85a9b9f0e1f4f (patch)
tree999bbe25775da5feff5d02151132607973a82c1a /lib
parent4bae8227d9dd7cb61ceb6bfaad04bf0fc0f720ca (diff)
Load the test schema through Rails, and keep the search trigger installed
Diffstat (limited to 'lib')
-rw-r--r--lib/tasks/init.rake4
-rw-r--r--lib/tasks/test_db.rake19
2 files changed, 4 insertions, 19 deletions
diff --git a/lib/tasks/init.rake b/lib/tasks/init.rake
index 16575345..adfaddfd 100644
--- a/lib/tasks/init.rake
+++ b/lib/tasks/init.rake
@@ -77,3 +77,7 @@ namespace :cccms do
77 end 77 end
78 end 78 end
79end 79end
80
81Rake::Task["db:schema:load"].enhance do
82 Page.ensure_search_vector_trigger!
83end
diff --git a/lib/tasks/test_db.rake b/lib/tasks/test_db.rake
deleted file mode 100644
index 0a7a17d7..00000000
--- a/lib/tasks/test_db.rake
+++ /dev/null
@@ -1,19 +0,0 @@
1namespace :db do
2 namespace :test do
3 task :load_schema do
4 ActiveRecord::Base.establish_connection(:test)
5 ActiveRecord::Schema.verbose = false
6 load "#{Rails.root}/db/schema.rb"
7 end
8
9 task :prepare => :environment do
10 begin
11 ActiveRecord::Base.establish_connection(:test)
12 ActiveRecord::Base.connection
13 rescue
14 system("psql -U postgres postgres -c \"CREATE DATABASE psql_test OWNER psql ENCODING 'UTF8';\"")
15 end
16 Rake::Task['db:test:load_schema'].invoke
17 end
18 end
19end