diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-06-27 22:52:50 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-06-27 22:52:50 +0200 |
| commit | 9a19a0494ef51cdac9a78e24d517ca48ba44c453 (patch) | |
| tree | 8eaae12d8047a40e29d3ea7ff3116b5c869e04bd /lib/tasks/test_db.rake | |
| parent | 85a01e35274b8d4d4165a7b26bd7986e211246bb (diff) | |
| parent | 1853082fcd8c067390c246f9daa01a9b47387497 (diff) | |
Migration from Rails 2.3.5 to Rails 8.1 successful.
Merging dev branch.
Diffstat (limited to 'lib/tasks/test_db.rake')
| -rw-r--r-- | lib/tasks/test_db.rake | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/tasks/test_db.rake b/lib/tasks/test_db.rake new file mode 100644 index 0000000..0a7a17d --- /dev/null +++ b/lib/tasks/test_db.rake | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | namespace :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 | ||
| 19 | end | ||
