diff --git a/db/migrate/20170506212014_add_account_registrar_fk.rb b/db/migrate/20170506212014_add_account_registrar_fk.rb new file mode 100644 index 000000000..3f73cb83f --- /dev/null +++ b/db/migrate/20170506212014_add_account_registrar_fk.rb @@ -0,0 +1,6 @@ +class AddAccountRegistrarFk < ActiveRecord::Migration + def change + change_column :accounts, :registrar_id, :integer, null: false + add_foreign_key :accounts, :registrars + end +end diff --git a/db/structure.sql b/db/structure.sql index 429b23f73..612f58532 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -327,7 +327,7 @@ ALTER SEQUENCE account_activities_id_seq OWNED BY account_activities.id; CREATE TABLE accounts ( id integer NOT NULL, - registrar_id integer, + registrar_id integer NOT NULL, account_type character varying, balance numeric(10,2) DEFAULT 0.0 NOT NULL, created_at timestamp without time zone, @@ -4792,6 +4792,14 @@ ALTER TABLE ONLY account_activities ADD CONSTRAINT fk_rails_b80dbb973d FOREIGN KEY (bank_transaction_id) REFERENCES bank_transactions(id); +-- +-- Name: fk_rails_c9f635c0b3; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY accounts + ADD CONSTRAINT fk_rails_c9f635c0b3 FOREIGN KEY (registrar_id) REFERENCES registrars(id); + + -- -- Name: fk_rails_ce38d749f6; Type: FK CONSTRAINT; Schema: public; Owner: - -- @@ -5298,3 +5306,5 @@ INSERT INTO schema_migrations (version) VALUES ('20170506205356'); INSERT INTO schema_migrations (version) VALUES ('20170506205946'); +INSERT INTO schema_migrations (version) VALUES ('20170506212014'); +