diff --git a/db/migrate/20181129203927_devise_create_users.rb b/db/migrate/20181129203927_devise_create_users.rb index 80b8086..091abfd 100644 --- a/db/migrate/20181129203927_devise_create_users.rb +++ b/db/migrate/20181129203927_devise_create_users.rb @@ -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 diff --git a/db/migrate/20190623160009_rename_country_states_to_federal_subjects.rb b/db/migrate/20190623160009_rename_country_states_to_federal_subjects.rb deleted file mode 100644 index f9b28ee..0000000 --- a/db/migrate/20190623160009_rename_country_states_to_federal_subjects.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -class RenameCountryStatesToFederalSubjects < ActiveRecord::Migration[6.0] - def change - rename_table :country_states, :federal_subjects - end -end diff --git a/db/migrate/20190623160130_rename_country_state_to_federal_subject.rb b/db/migrate/20190623160130_rename_country_state_to_federal_subject.rb deleted file mode 100644 index c5ca5ea..0000000 --- a/db/migrate/20190623160130_rename_country_state_to_federal_subject.rb +++ /dev/null @@ -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 diff --git a/db/structure.sql b/db/structure.sql index 1887d51..d6d0b23 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -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'),