Skip to content

Commit

Permalink
Merge pull request #313 from UKHomeOffice/rdsupdate
Browse files Browse the repository at this point in the history
Migrate to PostgreSQL v12
  • Loading branch information
oyelekci authored Jan 20, 2022
2 parents d46086a + 160cc22 commit fab3fde
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 28 deletions.
4 changes: 2 additions & 2 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ steps:
POSTGRES_USER: phub
POSTGRES_PASSWORD: phub_password
commands:
- docker run -d --name phub-api-postgres-${DRONE_BUILD_NUMBER} -e POSTGRES_USER -e POSTGRES_PASSWORD postgres:9.6.1
- docker run -d --name phub-api-postgres-${DRONE_BUILD_NUMBER} -e POSTGRES_USER -e POSTGRES_PASSWORD postgres:12.5
- sleep 5
- docker run --name phub-api-${DRONE_BUILD_NUMBER} -t --rm --env-file=platform-hub-api/.env.test -e PHUB_DB_HOST=phub-api-postgres-${DRONE_BUILD_NUMBER} --link phub-api-postgres-${DRONE_BUILD_NUMBER} platform-hub-api:${DRONE_COMMIT_SHA} /bin/bash -c "cd /app; bin/setup; bin/rails server -d; sleep 5; curl -s -f http://127.0.0.1:3000/healthz"
when:
Expand Down Expand Up @@ -196,7 +196,7 @@ services:
DOCKER_SERVER: tcp://127.0.0.1:2375

- name: postgres
image: postgres:9.6.1
image: postgres:12.5
ports:
- 5432
environment:
Expand Down
2 changes: 1 addition & 1 deletion platform-hub-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ The following packages are required to run the API (may vary across Operating Sy

[Bundler](http://bundler.io/) is used for dependency management. Install this with `gem install bundler`.

#### PostgresSQL v9.6.1
#### PostgresSQL v12.5

For local development, we recommend using the scripts provided in `./bin/postgres/*` to easily manage a locally running PostgreSQL container with the correct config set up already. See the [relevant README doc](bin/postgres/README.md) for more details.

Expand Down
2 changes: 1 addition & 1 deletion platform-hub-api/bin/postgres/.env
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

export PHUB_PG_VERSION=9.6.1
export PHUB_PG_VERSION=12.5

export PHUB_PG_USER=phub
export PHUB_PG_PASSWORD=phub_password
Expand Down
34 changes: 10 additions & 24 deletions platform-hub-api/db/structure.sql
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
--
-
-- PostgreSQL database dump
--

-- Dumped from database version 9.6.1
-- Dumped by pg_dump version 9.6.17
-- Dumped from database version 12.5 (Debian 12.5-1.pgdg100+1)
-- Dumped by pg_dump version 12.9 (Ubuntu 12.9-2.pgdg20.04+1)

SET statement_timeout = 0;
SET lock_timeout = 0;
Expand All @@ -16,20 +16,6 @@ SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;

--
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -
--

CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;


--
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -
--

COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';


--
-- Name: pg_trgm; Type: EXTENSION; Schema: -; Owner: -
--
Expand Down Expand Up @@ -60,7 +46,7 @@ COMMENT ON EXTENSION "uuid-ossp" IS 'generate universally unique identifiers (UU

SET default_tablespace = '';

SET default_with_oids = false;
SET default_table_access_method = heap;

--
-- Name: allocations; Type: TABLE; Schema: public; Owner: -
Expand Down Expand Up @@ -155,6 +141,7 @@ CREATE TABLE public.audits (
--

CREATE SEQUENCE public.audits_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
Expand Down Expand Up @@ -225,6 +212,7 @@ CREATE TABLE public.delayed_jobs (
--

CREATE SEQUENCE public.delayed_jobs_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
Expand Down Expand Up @@ -412,7 +400,7 @@ CREATE TABLE public.platform_themes (
slug character varying NOT NULL,
description text NOT NULL,
image_url character varying NOT NULL,
colour character varying,
colour character varying NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
resources json
Expand Down Expand Up @@ -467,9 +455,9 @@ CREATE TABLE public.qa_entries (

CREATE TABLE public.read_marks (
id integer NOT NULL,
readable_type character varying NOT NULL,
readable_type character varying,
readable_id uuid,
reader_type character varying NOT NULL,
reader_type character varying,
reader_id uuid,
"timestamp" timestamp without time zone
);
Expand All @@ -480,6 +468,7 @@ CREATE TABLE public.read_marks (
--

CREATE SEQUENCE public.read_marks_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
Expand Down Expand Up @@ -1282,7 +1271,6 @@ INSERT INTO "schema_migrations" (version) VALUES
('20171003130836'),
('20171005115420'),
('20171010111440'),
('20171012110416'),
('20171031164247'),
('20171114100517'),
('20171127115843'),
Expand All @@ -1306,5 +1294,3 @@ INSERT INTO "schema_migrations" (version) VALUES
('20181109123528'),
('20181114155258'),
('20181204101525');


0 comments on commit fab3fde

Please sign in to comment.