aboutsummaryrefslogtreecommitdiffstats
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/migrate/094_remove_old_tags_foreign_key.rb17
-rw-r--r--db/schema.rb6
2 files changed, 20 insertions, 3 deletions
diff --git a/db/migrate/094_remove_old_tags_foreign_key.rb b/db/migrate/094_remove_old_tags_foreign_key.rb
new file mode 100644
index 000000000..1a87b97c2
--- /dev/null
+++ b/db/migrate/094_remove_old_tags_foreign_key.rb
@@ -0,0 +1,17 @@
+class RemoveOldTagsForeignKey < ActiveRecord::Migration
+ def self.up
+ if ActiveRecord::Base.connection.adapter_name == "PostgreSQL"
+ execute "ALTER TABLE has_tag_string_tags DROP CONSTRAINT fk_public_body_tags_public_body"
+ end
+
+ remove_index :public_body_tags, [:public_body_id, :name, :value]
+ remove_index :public_body_tags, :name
+
+ add_index :has_tag_string_tags, [:model, :model_id, :name, :value]
+ add_index :has_tag_string_tags, :name
+ end
+
+ def self.down
+ raise "no reverse migration"
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 6df97a137..cf117c4e3 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -9,7 +9,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 93) do
+ActiveRecord::Schema.define(:version => 94) do
create_table "acts_as_xapian_jobs", :force => true do |t|
t.string "model", :null => false
@@ -73,9 +73,9 @@ ActiveRecord::Schema.define(:version => 93) do
t.string "model", :null => false
end
+ add_index "has_tag_string_tags", ["model", "model_id", "name", "value"], :name => "index_has_tag_string_tags_on_model_and_model_id_and_name_and_va"
add_index "has_tag_string_tags", ["model", "model_id"], :name => "index_has_tag_string_tags_on_model_and_model_id"
- add_index "has_tag_string_tags", ["model_id", "name", "value"], :name => "index_public_body_tags_on_public_body_id_and_name_and_value", :unique => true
- add_index "has_tag_string_tags", ["name"], :name => "index_public_body_tags_on_name"
+ add_index "has_tag_string_tags", ["name"], :name => "index_has_tag_string_tags_on_name"
create_table "holidays", :force => true do |t|
t.date "day"