wip: currently rewriting the project as a full stack application tangled.org/kacaii.dev/sigo
gleam
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

:card_file_box: add support for brigades / groups

Kacaii 5daa65e6 a704ec5f

+55 -7
+15
README.md
··· 36 36 BOOLEAN is_active 37 37 } 38 38 39 + brigade { 40 + UUID id PK 41 + varchar(255) name 42 + TEXT description 43 + BOOLEAN is_active 44 + } 45 + 46 + brigade_membership }o--o{ user_account : is_member_of 47 + brigade_membership }o--o{ brigade : is_part_of 48 + brigade_membership { 49 + UUID id PK 50 + UUID user_id FK 51 + UUID group_id FK 52 + } 53 + 39 54 ocurrence_type |o--o{ ocurrence_type : has_parent 40 55 ocurrence_type { 41 56 UUID id PK
+40 -7
priv/sql/rebuild_database.sql
··· 1 1 --  DROP ------------------------------------------------------------------- 2 2 BEGIN; 3 3 4 - DROP TABLE IF EXISTS ocurrence; 5 - DROP TABLE IF EXISTS ocurrence_type; 4 + DROP INDEX IF EXISTS idx_brigade_membership_brigade_id; 5 + DROP INDEX IF EXISTS idx_brigade_membership_user_id; 6 + DROP INDEX IF EXISTS idx_occurrence_applicant_id; 7 + 8 + DROP TABLE IF EXISTS occurrence; 9 + DROP TABLE IF EXISTS occurrence_type; 10 + DROP TABLE IF EXISTS brigade_membership; 11 + DROP TABLE IF EXISTS brigade; 6 12 DROP TABLE IF EXISTS user_account; 7 13 DROP TABLE IF EXISTS user_role; 14 + 8 15 9 16 COMMIT; 10 17 ··· 31 38 updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP 32 39 ); 33 40 34 - CREATE TABLE IF NOT EXISTS ocurrence_type ( 41 + 42 + CREATE TABLE IF NOT EXISTS brigade ( 43 + id UUID PRIMARY KEY DEFAULT GEN_RANDOM_UUID(), 44 + name VARCHAR(255) DEFAULT NULL, 45 + description TEXT DEFAULT NULL, 46 + is_active BOOLEAN DEFAULT FALSE 47 + ); 48 + 49 + CREATE TABLE IF NOT EXISTS brigade_membership ( 50 + id UUID PRIMARY KEY DEFAULT GEN_RANDOM_UUID(), 51 + user_id UUID REFERENCES user_account (id) 52 + ON UPDATE CASCADE ON DELETE SET NULL, 53 + brigade_id UUID REFERENCES brigade (id) 54 + ON UPDATE CASCADE ON DELETE CASCADE 55 + ); 56 + 57 + CREATE INDEX IF NOT EXISTS idx_brigade_membership_user_id 58 + ON brigade_membership (user_id); 59 + 60 + CREATE INDEX IF NOT EXISTS idx_brigade_membership_brigade_id 61 + ON brigade_membership (brigade_id); 62 + 63 + 64 + CREATE TABLE IF NOT EXISTS occurrence_type ( 35 65 id UUID PRIMARY KEY DEFAULT GEN_RANDOM_UUID(), 36 66 -- This way we dont need to have separate tables for type and subtype 37 67 -- vv 38 - parent_type UUID REFERENCES ocurrence_type (id) 68 + parent_type UUID REFERENCES occurrence_type (id) 39 69 ON UPDATE CASCADE ON DELETE CASCADE DEFAULT NULL, 40 70 name VARCHAR(255) UNIQUE NOT NULL, 41 71 description TEXT, ··· 43 73 ); 44 74 45 75 46 - CREATE TABLE IF NOT EXISTS ocurrence ( 76 + CREATE TABLE IF NOT EXISTS occurrence ( 47 77 id UUID PRIMARY KEY DEFAULT GEN_RANDOM_UUID(), 48 78 applicant_id UUID REFERENCES user_account (id) 49 79 ON UPDATE CASCADE ON DELETE SET NULL, 50 - type_id UUID REFERENCES ocurrence_type (id) 80 + type_id UUID REFERENCES occurrence_type (id) 51 81 ON UPDATE CASCADE ON DELETE SET NULL, 52 - subtype_id UUID REFERENCES ocurrence_type (id) 82 + subtype_id UUID REFERENCES occurrence_type (id) 53 83 ON UPDATE CASCADE ON DELETE SET NULL DEFAULT NULL, 54 84 description TEXT, 55 85 ··· 62 92 updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, 63 93 resolved_at TIMESTAMP DEFAULT NULL 64 94 ); 95 + 96 + CREATE INDEX IF NOT EXISTS idx_occurrence_applicant_id 97 + ON occurence (applicant_id); 65 98 66 99 COMMIT;