diff options
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/036_add_public_body_tags.rb | 17 | ||||
-rw-r--r-- | db/schema.rb | 10 |
2 files changed, 26 insertions, 1 deletions
diff --git a/db/migrate/036_add_public_body_tags.rb b/db/migrate/036_add_public_body_tags.rb new file mode 100644 index 000000000..fc64b7576 --- /dev/null +++ b/db/migrate/036_add_public_body_tags.rb @@ -0,0 +1,17 @@ +class AddPublicBodyTags < ActiveRecord::Migration + def self.up + create_table :public_body_tags do |t| + t.column :public_body_id, :integer, :null => false + t.column :name, :text, :null => false + t.column :created_at, :datetime, :null => false + end + + execute "ALTER TABLE public_body_tags ADD CONSTRAINT fk_public_body_tags_public_body FOREIGN KEY (public_body_id) REFERENCES public_bodies(id)" + add_index :public_body_tags, [:public_body_id, :name], :unique => true + end + + def self.down + drop_table :public_body_tags + end +end + diff --git a/db/schema.rb b/db/schema.rb index a247262dc..c2d826b92 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 => 35) do +ActiveRecord::Schema.define(:version => 36) do create_table "incoming_messages", :force => true do |t| t.integer "info_request_id", :null => false @@ -79,6 +79,14 @@ ActiveRecord::Schema.define(:version => 35) do t.datetime "updated_at", :null => false end + create_table "public_body_tags", :force => true do |t| + t.integer "public_body_id", :null => false + t.text "name", :null => false + t.datetime "created_at", :null => false + end + + add_index "public_body_tags", ["public_body_id", "name"], :name => "index_public_body_tags_on_public_body_id_and_name", :unique => true + create_table "public_body_versions", :force => true do |t| t.integer "public_body_id" t.integer "version" |