aboutsummaryrefslogtreecommitdiffstats
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/migrate/090_remove_tag_uniqueness.rb16
-rw-r--r--db/schema.rb4
2 files changed, 18 insertions, 2 deletions
diff --git a/db/migrate/090_remove_tag_uniqueness.rb b/db/migrate/090_remove_tag_uniqueness.rb
new file mode 100644
index 000000000..1c06de439
--- /dev/null
+++ b/db/migrate/090_remove_tag_uniqueness.rb
@@ -0,0 +1,16 @@
+class RemoveTagUniqueness < ActiveRecord::Migration
+ def self.up
+ # MySQL cannot index text blobs like this
+ # XXX perhaps should change :name/:value to be a :string
+ if ActiveRecord::Base.connection.adapter_name != "MySQL"
+ remove_index :public_body_tags, [:public_body_id, :name]
+ # allow the key to repeat, but not the value also
+ add_index :public_body_tags, [:public_body_id, :name, :value], :unique => true
+ end
+ end
+
+ def self.down
+ raise "No reverse migration"
+ end
+end
+
diff --git a/db/schema.rb b/db/schema.rb
index 7ac84dd30..c79ef31c9 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 => 89) do
+ActiveRecord::Schema.define(:version => 90) do
create_table "acts_as_xapian_jobs", :force => true do |t|
t.string "model", :null => false
@@ -175,7 +175,7 @@ ActiveRecord::Schema.define(:version => 89) do
t.text "value"
end
- add_index "public_body_tags", ["name", "public_body_id"], :name => "index_public_body_tags_on_public_body_id_and_name", :unique => true
+ add_index "public_body_tags", ["name", "public_body_id", "value"], :name => "index_public_body_tags_on_public_body_id_and_name_and_value", :unique => true
add_index "public_body_tags", ["name"], :name => "index_public_body_tags_on_name"
create_table "public_body_versions", :force => true do |t|