1
0
Fork 0

Merge migrations

This commit is contained in:
Alex Kotov 2019-07-22 08:07:47 +05:00
parent f3f292f219
commit 32450b6642
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
4 changed files with 11 additions and 27 deletions

View file

@ -26,7 +26,7 @@ class DeviseCreateUsers < ActiveRecord::Migration[5.2]
end
end
create_table :country_states do |t|
create_table :federal_subjects do |t|
t.timestamps null: false
t.string :english_name, null: false, index: { unique: true }
@ -36,7 +36,7 @@ class DeviseCreateUsers < ActiveRecord::Migration[5.2]
create_table :regional_offices do |t|
t.timestamps null: false
t.references :country_state, null: false, index: { unique: true }
t.references :federal_subject, null: false, index: { unique: true }
end
create_table :people do |t|
@ -137,6 +137,6 @@ class DeviseCreateUsers < ActiveRecord::Migration[5.2]
add_foreign_key :account_roles, :accounts
add_foreign_key :account_roles, :roles
add_foreign_key :accounts, :people
add_foreign_key :regional_offices, :country_states
add_foreign_key :regional_offices, :federal_subjects
end
end

View file

@ -1,7 +0,0 @@
# frozen_string_literal: true
class RenameCountryStatesToFederalSubjects < ActiveRecord::Migration[6.0]
def change
rename_table :country_states, :federal_subjects
end
end

View file

@ -1,7 +0,0 @@
# frozen_string_literal: true
class RenameCountryStateToFederalSubject < ActiveRecord::Migration[6.0]
def change
rename_column :regional_offices, :country_state_id, :federal_subject_id
end
end

View file

@ -1067,6 +1067,14 @@ ALTER TABLE ONLY public.accounts
ADD CONSTRAINT fk_rails_777d10a224 FOREIGN KEY (person_id) REFERENCES public.people(id);
--
-- Name: regional_offices fk_rails_7a6d5fdd9a; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.regional_offices
ADD CONSTRAINT fk_rails_7a6d5fdd9a FOREIGN KEY (federal_subject_id) REFERENCES public.federal_subjects(id);
--
-- Name: user_omniauths fk_rails_8c1c9cb22e; Type: FK CONSTRAINT; Schema: public; Owner: -
--
@ -1091,14 +1099,6 @@ ALTER TABLE ONLY public.person_comments
ADD CONSTRAINT fk_rails_a9c7b4ae11 FOREIGN KEY (account_id) REFERENCES public.accounts(id);
--
-- Name: regional_offices fk_rails_ba9a6303c5; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.regional_offices
ADD CONSTRAINT fk_rails_ba9a6303c5 FOREIGN KEY (federal_subject_id) REFERENCES public.federal_subjects(id);
--
-- Name: people fk_rails_cb9b5a21ec; Type: FK CONSTRAINT; Schema: public; Owner: -
--
@ -1141,8 +1141,6 @@ INSERT INTO "schema_migrations" (version) VALUES
('20181129203927'),
('20181130024918'),
('20190427141639'),
('20190623160009'),
('20190623160130'),
('20190627000456'),
('20190708130309'),
('20190715210610'),