diff options
author | Christopher Baines <mail@cbaines.net> | 2018-06-01 20:42:03 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2018-06-01 20:42:03 +0100 |
commit | f98bdb86d09f803495c9c203c350a7f06d96a8de (patch) | |
tree | fef67e02a174a15b0795b3737a2667c9eb6e2206 /db | |
parent | 3fa08e707fbc7899c0964bef4b501e137991d838 (diff) | |
download | govuk-mini-environment-admin-f98bdb86d09f803495c9c203c350a7f06d96a8de.tar govuk-mini-environment-admin-f98bdb86d09f803495c9c203c350a7f06d96a8de.tar.gz |
Add an optional DataSnapshot to the MiniEnvironment model
To store if a DataSnapshot is being used.
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20180601182655_add_data_snapshot_to_mini_environment.rb | 9 | ||||
-rw-r--r-- | db/structure.sql | 21 |
2 files changed, 28 insertions, 2 deletions
diff --git a/db/migrate/20180601182655_add_data_snapshot_to_mini_environment.rb b/db/migrate/20180601182655_add_data_snapshot_to_mini_environment.rb new file mode 100644 index 0000000..8c12cf0 --- /dev/null +++ b/db/migrate/20180601182655_add_data_snapshot_to_mini_environment.rb @@ -0,0 +1,9 @@ +class AddDataSnapshotToMiniEnvironment < ActiveRecord::Migration[5.1] + def change + add_reference( + :mini_environments, + :data_snapshot, + foreign_key: { to_table: :govuk_guix_data_snapshots } + ) + end +end diff --git a/db/structure.sql b/db/structure.sql index 7b5d81f..9e03d7d 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -167,7 +167,8 @@ CREATE TABLE public.mini_environments ( backend_type character varying, backend_id bigint, backend_data jsonb, - signon_users jsonb + signon_users jsonb, + data_snapshot_id bigint ); @@ -575,6 +576,13 @@ CREATE INDEX index_mini_environments_on_backend_type_and_backend_id ON public.mi -- +-- Name: index_mini_environments_on_data_snapshot_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_mini_environments_on_data_snapshot_id ON public.mini_environments USING btree (data_snapshot_id); + + +-- -- Name: index_mini_environments_on_govuk_guix_revision_id; Type: INDEX; Schema: public; Owner: - -- @@ -606,6 +614,14 @@ ALTER TABLE ONLY public.govuk_guix_data_snapshots -- +-- Name: mini_environments fk_rails_eba071cb24; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.mini_environments + ADD CONSTRAINT fk_rails_eba071cb24 FOREIGN KEY (data_snapshot_id) REFERENCES public.govuk_guix_data_snapshots(id); + + +-- -- PostgreSQL database dump complete -- @@ -643,6 +659,7 @@ INSERT INTO "schema_migrations" (version) VALUES ('20180527183740'), ('20180530191341'), ('20180530192706'), -('20180601153537'); +('20180601153537'), +('20180601182655'); |