diff options
Diffstat (limited to 'db/migrate/049_track_things.rb')
-rw-r--r-- | db/migrate/049_track_things.rb | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/db/migrate/049_track_things.rb b/db/migrate/049_track_things.rb index 65871bc73..aad50a69e 100644 --- a/db/migrate/049_track_things.rb +++ b/db/migrate/049_track_things.rb @@ -12,12 +12,14 @@ class TrackThings < ActiveRecord::Migration t.column :track_medium, :string, :null => false end - execute "ALTER TABLE track_things ADD CONSTRAINT fk_track_request_tracking_user FOREIGN KEY (tracking_user_id) REFERENCES users(id)" - execute "ALTER TABLE track_things ADD CONSTRAINT fk_track_request_tracked_user FOREIGN KEY (tracked_user_id) REFERENCES users(id)" - execute "ALTER TABLE track_things ADD CONSTRAINT fk_track_request_info_request FOREIGN KEY (info_request_id) REFERENCES info_requests(id)" - execute "ALTER TABLE track_things ADD CONSTRAINT fk_track_request_public_body FOREIGN KEY (public_body_id) REFERENCES public_bodies(id)" + if ActiveRecord::Base.connection.adapter_name == "PostgreSQL" + execute "ALTER TABLE track_things ADD CONSTRAINT fk_track_request_tracking_user FOREIGN KEY (tracking_user_id) REFERENCES users(id)" + execute "ALTER TABLE track_things ADD CONSTRAINT fk_track_request_tracked_user FOREIGN KEY (tracked_user_id) REFERENCES users(id)" + execute "ALTER TABLE track_things ADD CONSTRAINT fk_track_request_info_request FOREIGN KEY (info_request_id) REFERENCES info_requests(id)" + execute "ALTER TABLE track_things ADD CONSTRAINT fk_track_request_public_body FOREIGN KEY (public_body_id) REFERENCES public_bodies(id)" + end - create_table :track_things_sent_emails do |t| + create_table :track_things_sent_emails do |t| t.column :track_thing_id, :integer, :null => false t.column :info_request_event_id, :integer, :default => nil @@ -25,9 +27,11 @@ class TrackThings < ActiveRecord::Migration t.column :public_body_id, :integer, :default => nil end - execute "ALTER TABLE track_things_sent_emails ADD CONSTRAINT fk_track_request_info_request_event FOREIGN KEY (info_request_event_id) REFERENCES info_request_events(id)" - execute "ALTER TABLE track_things_sent_emails ADD CONSTRAINT fk_track_request_user FOREIGN KEY (user_id) REFERENCES users(id)" - execute "ALTER TABLE track_things_sent_emails ADD CONSTRAINT fk_track_request_public_body FOREIGN KEY (user_id) REFERENCES users(id)" + if ActiveRecord::Base.connection.adapter_name == "PostgreSQL" + execute "ALTER TABLE track_things_sent_emails ADD CONSTRAINT fk_track_request_info_request_event FOREIGN KEY (info_request_event_id) REFERENCES info_request_events(id)" + execute "ALTER TABLE track_things_sent_emails ADD CONSTRAINT fk_track_request_user FOREIGN KEY (user_id) REFERENCES users(id)" + execute "ALTER TABLE track_things_sent_emails ADD CONSTRAINT fk_track_request_public_body FOREIGN KEY (user_id) REFERENCES users(id)" + end end def self.down |