diff --git a/src/backend/migrations/002-add-profile-img.sql b/src/backend/migrations/002-add-profile-img.sql index ae7f620918..361fc76e1e 100644 --- a/src/backend/migrations/002-add-profile-img.sql +++ b/src/backend/migrations/002-add-profile-img.sql @@ -7,4 +7,4 @@ BEGIN; ALTER TABLE IF EXISTS public.users ADD COLUMN IF NOT EXISTS profile_img VARCHAR; -- Commit the transaction -COMMIT; \ No newline at end of file +COMMIT; diff --git a/src/backend/migrations/003-project-roles.sql b/src/backend/migrations/003-project-roles.sql index c4f75e5c5d..6c4bf50c69 100644 --- a/src/backend/migrations/003-project-roles.sql +++ b/src/backend/migrations/003-project-roles.sql @@ -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; \ No newline at end of file +COMMIT; diff --git a/src/backend/migrations/004-organisation-odk-creds.sql b/src/backend/migrations/004-organisation-odk-creds.sql new file mode 100644 index 0000000000..44a5eecb15 --- /dev/null +++ b/src/backend/migrations/004-organisation-odk-creds.sql @@ -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; diff --git a/src/backend/migrations/init/fmtm_base_schema.sql b/src/backend/migrations/init/fmtm_base_schema.sql index 857ef6e430..3542951c56 100644 --- a/src/backend/migrations/init/fmtm_base_schema.sql +++ b/src/backend/migrations/init/fmtm_base_schema.sql @@ -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 diff --git a/src/backend/migrations/revert/002-add-profile-img.sql b/src/backend/migrations/revert/002-add-profile-img.sql index 49b3e65f1d..5b02224dda 100644 --- a/src/backend/migrations/revert/002-add-profile-img.sql +++ b/src/backend/migrations/revert/002-add-profile-img.sql @@ -6,4 +6,4 @@ ALTER TABLE IF EXISTS public.users DROP COLUMN IF EXISTS profile_img; -- Commit the transaction -COMMIT; \ No newline at end of file +COMMIT; diff --git a/src/backend/migrations/revert/004-organisation-odk-creds.sql b/src/backend/migrations/revert/004-organisation-odk-creds.sql new file mode 100644 index 0000000000..9d0494064d --- /dev/null +++ b/src/backend/migrations/revert/004-organisation-odk-creds.sql @@ -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;