From 88e40fece6c315287e1cb9d3f102607341089a9b Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Wed, 15 May 2024 18:56:18 +0200 Subject: [PATCH] Add a column in family table to toggle genealogy feature --- .../2024-05-15-164434_genealogy_as_feature/down.sql | 3 +++ .../migrations/2024-05-15-164434_genealogy_as_feature/up.sql | 5 +++++ geneit_backend/src/models.rs | 1 + geneit_backend/src/schema.rs | 1 + 4 files changed, 10 insertions(+) create mode 100644 geneit_backend/migrations/2024-05-15-164434_genealogy_as_feature/down.sql create mode 100644 geneit_backend/migrations/2024-05-15-164434_genealogy_as_feature/up.sql diff --git a/geneit_backend/migrations/2024-05-15-164434_genealogy_as_feature/down.sql b/geneit_backend/migrations/2024-05-15-164434_genealogy_as_feature/down.sql new file mode 100644 index 0000000..88da697 --- /dev/null +++ b/geneit_backend/migrations/2024-05-15-164434_genealogy_as_feature/down.sql @@ -0,0 +1,3 @@ +-- Remove column to toggle genealogy +ALTER TABLE public.families + DROP COLUMN enable_genealogy; \ No newline at end of file diff --git a/geneit_backend/migrations/2024-05-15-164434_genealogy_as_feature/up.sql b/geneit_backend/migrations/2024-05-15-164434_genealogy_as_feature/up.sql new file mode 100644 index 0000000..4238972 --- /dev/null +++ b/geneit_backend/migrations/2024-05-15-164434_genealogy_as_feature/up.sql @@ -0,0 +1,5 @@ +-- Add column to toggle genealogy +ALTER TABLE public.families + ADD enable_genealogy boolean NOT NULL DEFAULT false; +COMMENT +ON COLUMN public.families.enable_genealogy IS 'Specify whether genealogy feature is enabled for the family'; diff --git a/geneit_backend/src/models.rs b/geneit_backend/src/models.rs index e901fac..596d092 100644 --- a/geneit_backend/src/models.rs +++ b/geneit_backend/src/models.rs @@ -65,6 +65,7 @@ pub struct Family { pub name: String, pub invitation_code: String, pub disable_couple_photos: bool, + pub enable_genealogy: bool, } impl Family { diff --git a/geneit_backend/src/schema.rs b/geneit_backend/src/schema.rs index 708d30a..f681f84 100644 --- a/geneit_backend/src/schema.rs +++ b/geneit_backend/src/schema.rs @@ -29,6 +29,7 @@ diesel::table! { #[max_length = 7] invitation_code -> Varchar, disable_couple_photos -> Bool, + enable_genealogy -> Bool, } }