Changes for page Data Structures

Last modified by Kerem Yollu on 2025/03/23 11:28

From version 11.3
edited by Kerem Yollu
on 2025/03/22 14:59
Change comment: There is no comment for this version
To version 13.1
edited by Kerem Yollu
on 2025/03/23 10:54
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -1,10 +1,12 @@
1 1  = Data Structures for KPM and database relations =
2 2  
3 3  
4 -= Models =
4 += Core Entity Tables =
5 5  
6 6  == Address ==
7 7  
8 +{{diagram/}}
9 +
8 8  {{code language="SQL"}}
9 9  -- Table: public.address
10 10  
... ... @@ -55,23 +55,45 @@
55 55   IS 'Optional: for geolocation';
56 56  {{/code}}
57 57  
58 -== Common Stand alone tables having the same Cols. and pointing to no other table ==
60 +== Lookup Tables without references. ==
59 59  
60 60  === Company ===
61 61  
62 62  * company_legal_form
63 63  * company_relation
64 -* company_stat
66 +* company_status
67 +* company_types
65 65  
69 +=== Project ===
70 +
71 +* project_areas
72 +* project_type
73 +* project_company_role
74 +* projects_person_role
75 +
76 +=== Task ===
77 +
78 +* task_category
79 +* task_type
80 +* task_status
81 +
82 +=== User ===
83 +
84 +* user_role
85 +* user_type
86 +
87 +=== Employee ===
88 +
89 +* employee_role
90 +* employee_status
91 +* employee_departement (this one i am not shure, maybe departments should be in company ?)
92 +
66 66  {{code language="sql"}}
67 67  DO $$
68 68  DECLARE
69 69   tname TEXT;
70 70  BEGIN
71 - FOREACH tname IN ARRAY ARRAY'company_legal_form','company_relation','company_status','company_type',
72 - 'task_status', 'task_type', 'task_category',
73 - 'user_role', 'user_type',
74 - 'project_type','project_areas', 'project_person_roles', 'project_company_role']
98 + FOREACH tname IN ARRAY ARRAY'TBALE_ONE','TABLE_TWO']
75 75   LOOP
76 76   EXECUTE format('
77 77   CREATE TABLE IF NOT EXISTS public.%I (
... ... @@ -87,4 +87,24 @@
87 87  END$$;
88 88  {{/code}}
89 89  
90 -== ==
114 +== Lookup Tables with references. ==
115 +
116 +=== Company ===
117 +
118 +* company_departements
119 +
120 +{{code language="sql"}}
121 +CREATE TABLE IF NOT EXISTS public.TABLE
122 +(
123 + uid SERIAL PRIMARY KEY,
124 + OTHER_TABLE_uid INTEGER NOT NULL REFERENCES public.OTHER_TABLE(uid) ON DELETE CASCADE,
125 + name VARCHAR(100) NOT NULL,
126 + description VARCHAR(255),
127 + creation_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
128 + updated_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP
129 +)
130 +TABLESPACE pg_default;
131 +
132 +ALTER TABLE IF EXISTS public.TABLE
133 + OWNER TO kpm_rw;
134 +{{/code}}