Skip to content

Commit

Permalink
build: add default odk credentials to organisations
Browse files Browse the repository at this point in the history
  • Loading branch information
spwoodcock committed Jan 21, 2024
1 parent c74855e commit 79347d4
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/backend/migrations/002-add-profile-img.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ BEGIN;
ALTER TABLE IF EXISTS public.users
ADD COLUMN IF NOT EXISTS profile_img VARCHAR;
-- Commit the transaction
COMMIT;
COMMIT;
2 changes: 1 addition & 1 deletion src/backend/migrations/003-project-roles.sql
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ ALTER TABLE public.user_roles ALTER COLUMN "role" TYPE public.projectrole USING
ALTER TYPE public.projectrole OWNER TO fmtm;

-- Commit the transaction
COMMIT;
COMMIT;
12 changes: 12 additions & 0 deletions src/backend/migrations/004-organisation-odk-creds.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-- ## Migration to:
-- * Add odk central credentials (str) to organisations table.

-- Start a transaction
BEGIN;

ALTER TABLE IF EXISTS public.organisations
ADD COLUMN IF NOT EXISTS odk_central_url VARCHAR,
ADD COLUMN IF NOT EXISTS odk_central_user VARCHAR,
ADD COLUMN IF NOT EXISTS odk_central_password VARCHAR;
-- Commit the transaction
COMMIT;
5 changes: 4 additions & 1 deletion src/backend/migrations/init/fmtm_base_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,10 @@ CREATE TABLE public.organisations (
logo character varying,
description character varying,
url character varying,
type public.organisationtype NOT NULL
type public.organisationtype NOT NULL,
odk_central_url character varying,
odk_central_user character varying,
odk_central_password character varying
);
ALTER TABLE public.organisations OWNER TO fmtm;
CREATE SEQUENCE public.organisations_id_seq
Expand Down
2 changes: 1 addition & 1 deletion src/backend/migrations/revert/002-add-profile-img.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ ALTER TABLE IF EXISTS public.users
DROP COLUMN IF EXISTS profile_img;

-- Commit the transaction
COMMIT;
COMMIT;
11 changes: 11 additions & 0 deletions src/backend/migrations/revert/004-organisation-odk-creds.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-- Start a transaction
BEGIN;

-- Remove the odk central credentials columns from the public.organisations table
ALTER TABLE IF EXISTS public.organisations
DROP COLUMN IF EXISTS odk_central_url CASCADE,
DROP COLUMN IF EXISTS odk_central_user CASCADE,
DROP COLUMN IF EXISTS odk_central_password CASCADE;

-- Commit the transaction
COMMIT;

0 comments on commit 79347d4

Please sign in to comment.