From 3b135d15e48eafb99395b3f1a62e15e5de1c5a4f Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Mon, 28 May 2018 20:36:00 +0100 Subject: Add a new model to track services Associated with a mini environment. This can also be used to store customisations over the chosen revision of govuk-guix. --- ...80527183740_create_mini_environment_services.rb | 11 ++++ db/structure.sql | 66 +++++++++++++++++++++- 2 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20180527183740_create_mini_environment_services.rb (limited to 'db') diff --git a/db/migrate/20180527183740_create_mini_environment_services.rb b/db/migrate/20180527183740_create_mini_environment_services.rb new file mode 100644 index 0000000..135889c --- /dev/null +++ b/db/migrate/20180527183740_create_mini_environment_services.rb @@ -0,0 +1,11 @@ +class CreateMiniEnvironmentServices < ActiveRecord::Migration[5.1] + def change + create_table :mini_environment_services do |t| + t.string :name + t.string :revision + t.references :mini_environment, foreign_key: true + + t.timestamps + end + end +end diff --git a/db/structure.sql b/db/structure.sql index 12c19cf..cd71ee3 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -84,6 +84,39 @@ CREATE TABLE public.govuk_guix_revisions ( ); +-- +-- Name: mini_environment_services; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.mini_environment_services ( + id bigint NOT NULL, + name character varying, + revision character varying, + mini_environment_id bigint, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +-- +-- Name: mini_environment_services_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.mini_environment_services_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: mini_environment_services_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.mini_environment_services_id_seq OWNED BY public.mini_environment_services.id; + + -- -- Name: mini_environments; Type: TABLE; Schema: public; Owner: - -- @@ -318,6 +351,13 @@ ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id; ALTER TABLE ONLY public.finished_terraform_jobs ALTER COLUMN id SET DEFAULT nextval('public.finished_terraform_jobs_id_seq'::regclass); +-- +-- Name: mini_environment_services id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.mini_environment_services ALTER COLUMN id SET DEFAULT nextval('public.mini_environment_services_id_seq'::regclass); + + -- -- Name: mini_environments id; Type: DEFAULT; Schema: public; Owner: - -- @@ -384,6 +424,14 @@ ALTER TABLE ONLY public.govuk_guix_revisions ADD CONSTRAINT govuk_guix_revisions_pkey PRIMARY KEY (commit_hash); +-- +-- Name: mini_environment_services mini_environment_services_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.mini_environment_services + ADD CONSTRAINT mini_environment_services_pkey PRIMARY KEY (id); + + -- -- Name: mini_environments mini_environments_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- @@ -447,6 +495,13 @@ ALTER TABLE ONLY public.users CREATE UNIQUE INDEX index_govuk_guix_revisions_on_commit_hash ON public.govuk_guix_revisions USING btree (commit_hash); +-- +-- Name: index_mini_environment_services_on_mini_environment_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_mini_environment_services_on_mini_environment_id ON public.mini_environment_services USING btree (mini_environment_id); + + -- -- Name: index_mini_environments_on_backend_type_and_backend_id; Type: INDEX; Schema: public; Owner: - -- @@ -469,6 +524,14 @@ ALTER TABLE ONLY public.mini_environments ADD CONSTRAINT fk_rails_12ab275069 FOREIGN KEY (govuk_guix_revision_id) REFERENCES public.govuk_guix_revisions(commit_hash); +-- +-- Name: mini_environment_services fk_rails_36052da616; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.mini_environment_services + ADD CONSTRAINT fk_rails_36052da616 FOREIGN KEY (mini_environment_id) REFERENCES public.mini_environments(id); + + -- -- PostgreSQL database dump complete -- @@ -503,6 +566,7 @@ INSERT INTO "schema_migrations" (version) VALUES ('20180410192329'), ('20180410192412'), ('20180417195307'), -('20180523062426'); +('20180523062426'), +('20180527183740'); -- cgit v1.2.3