aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert2018-01-08 21:46:28 +0100
committerRobert2018-01-09 12:32:19 +0100
commit023b0e2d7a2436eb63fd0add635eaba835a57618 (patch)
tree8ee02505027a5fb76326bf15790c3be66cbb515f
parent417465bb1c147ed1e58008516ba2f9fb7515e7a9 (diff)
downloadchouette-core-5506-testdb_migration_after_rollback.tar.bz2
-rw-r--r--db/schema.rb15
-rw-r--r--spec/support/referential.rb15
2 files changed, 27 insertions, 3 deletions
diff --git a/db/schema.rb b/db/schema.rb
index fa48a5643..cfc4d4464 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,12 +11,12 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20180105102012) do
+ActiveRecord::Schema.define(version: 20180108132310) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
- enable_extension "hstore"
enable_extension "postgis"
+ enable_extension "hstore"
enable_extension "unaccent"
create_table "access_links", id: :bigserial, force: :cascade do |t|
@@ -991,6 +991,17 @@ ActiveRecord::Schema.define(version: 20180105102012) do
add_index "workbenches", ["organisation_id"], name: "index_workbenches_on_organisation_id", using: :btree
add_index "workbenches", ["stop_area_referential_id"], name: "index_workbenches_on_stop_area_referential_id", using: :btree
+ create_table "workgroups", id: :bigserial, force: :cascade do |t|
+ t.string "name"
+ t.integer "line_referential_id", limit: 8
+ t.integer "stop_area_referential_id", limit: 8
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ end
+
+ add_index "workgroups", ["line_referential_id"], name: "index_workgroups_on_line_referential_id", using: :btree
+ add_index "workgroups", ["stop_area_referential_id"], name: "index_workgroups_on_stop_area_referential_id", using: :btree
+
add_foreign_key "access_links", "access_points", name: "aclk_acpt_fkey"
add_foreign_key "api_keys", "organisations"
add_foreign_key "compliance_check_blocks", "compliance_check_sets"
diff --git a/spec/support/referential.rb b/spec/support/referential.rb
index 497ff47a8..fbaf5e732 100644
--- a/spec/support/referential.rb
+++ b/spec/support/referential.rb
@@ -60,7 +60,7 @@ RSpec.configure do |config|
line_referential: line_referential,
stop_area_referential: stop_area_referential
)
- referential = FactoryGirl.create(
+ FactoryGirl.create(
:referential,
prefix: "first",
name: "first",
@@ -71,6 +71,19 @@ RSpec.configure do |config|
)
end
+ # Alas this still might not be sufficiant in certain cases (interruption of tests)
+ # to fix the problem of `rake db:rollback; rake db:migrate`. However the test database
+ # can also be cleanded by means of
+ # ```
+ # RAILS_ENV=test bundle exec ruby -I. -r config/environment.rb -e 'Referential.pluck(:slug).each{|s|Apartment::Tenant.drop(s)};Referential.delete_all'`
+ #
+ config.after :suite do
+ Referential.pluck(:slug).each do |name|
+ Apartment::Tenant.drop(name) rescue nil
+ end
+ Referential.delete_all
+ end
+
config.before(:each) do
DatabaseCleaner.strategy = :transaction
# Switch into the default tenant