︙ | | | ︙ | |
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
droit_membres INTEGER NOT NULL DEFAULT 1,
droit_compta INTEGER NOT NULL DEFAULT 1,
droit_inscription INTEGER NOT NULL DEFAULT 0,
droit_connexion INTEGER NOT NULL DEFAULT 1,
droit_config INTEGER NOT NULL DEFAULT 0,
cacher INTEGER NOT NULL DEFAULT 0,
id_cotisation_obligatoire INTEGER NULL REFERENCES cotisations (id)
);
-- Membres de l'asso
-- Table dynamique générée par l'application
-- voir Garradin\Membres\Champs.php
CREATE TABLE membres_sessions
-- Sessions
(
selecteur TEXT NOT NULL,
hash TEXT NOT NULL,
id_membre INTEGER NOT NULL,
expire TEXT NOT NULL CHECK (datetime(expire) IS NOT NULL AND datetime(expire) = expire),
FOREIGN KEY (id_membre) REFERENCES membres (id),
PRIMARY KEY (selecteur, id_membre)
);
CREATE TABLE IF NOT EXISTS cotisations
-- Types de cotisations et activités
(
id INTEGER PRIMARY KEY NOT NULL,
|
|
|
|
<
|
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
droit_membres INTEGER NOT NULL DEFAULT 1,
droit_compta INTEGER NOT NULL DEFAULT 1,
droit_inscription INTEGER NOT NULL DEFAULT 0,
droit_connexion INTEGER NOT NULL DEFAULT 1,
droit_config INTEGER NOT NULL DEFAULT 0,
cacher INTEGER NOT NULL DEFAULT 0,
id_cotisation_obligatoire INTEGER NULL REFERENCES cotisations (id) ON DELETE SET NULL
);
-- Membres de l'asso
-- Table dynamique générée par l'application
-- voir Garradin\Membres\Champs.php
CREATE TABLE IF NOT EXISTS membres_sessions
-- Sessions
(
selecteur TEXT NOT NULL,
hash TEXT NOT NULL,
id_membre INTEGER NOT NULL REFERENCES membres (id) ON DELETE CASCADE,
expire TEXT NOT NULL CHECK (datetime(expire) IS NOT NULL AND datetime(expire) = expire),
PRIMARY KEY (selecteur, id_membre)
);
CREATE TABLE IF NOT EXISTS cotisations
-- Types de cotisations et activités
(
id INTEGER PRIMARY KEY NOT NULL,
|
︙ | | | ︙ | |
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
FOREIGN KEY (id_categorie_compta) REFERENCES compta_categories (id)
);
CREATE TABLE IF NOT EXISTS cotisations_membres
-- Enregistrement des cotisations et activités
(
id INTEGER NOT NULL PRIMARY KEY,
id_membre INTEGER NOT NULL REFERENCES membres (id),
id_cotisation INTEGER NOT NULL REFERENCES cotisations (id),
date TEXT NOT NULL DEFAULT CURRENT_DATE CHECK (date(date) IS NOT NULL AND date(date) = date)
);
CREATE UNIQUE INDEX IF NOT EXISTS cm_unique ON cotisations_membres (id_membre, id_cotisation, date);
CREATE TABLE IF NOT EXISTS membres_operations
-- Liaision des enregistrement des paiements en compta
(
id_membre INTEGER NOT NULL REFERENCES membres (id),
id_operation INTEGER NOT NULL REFERENCES compta_journal (id),
id_cotisation INTEGER NULL REFERENCES cotisations_membres (id),
PRIMARY KEY (id_membre, id_operation)
);
CREATE TABLE IF NOT EXISTS rappels
-- Rappels de devoir renouveller une cotisation
(
id INTEGER NOT NULL PRIMARY KEY,
id_cotisation INTEGER NOT NULL REFERENCES cotisations (id),
delai INTEGER NOT NULL, -- Délai en jours pour envoyer le rappel
sujet TEXT NOT NULL,
texte TEXT NOT NULL
);
CREATE TABLE IF NOT EXISTS rappels_envoyes
-- Enregistrement des rappels envoyés à qui et quand
(
id INTEGER NOT NULL PRIMARY KEY,
id_membre INTEGER NOT NULL REFERENCES membres (id),
id_cotisation INTEGER NOT NULL REFERENCES cotisations (id),
id_rappel INTEGER NULL REFERENCES rappels (id),
date TEXT NOT NULL DEFAULT CURRENT_DATE CHECK (date(date) IS NOT NULL AND date(date) = date),
media INTEGER NOT NULL -- Média utilisé pour le rappel : 1 = email, 2 = courrier, 3 = autre
);
--
|
|
|
|
|
|
|
|
|
|
|
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
FOREIGN KEY (id_categorie_compta) REFERENCES compta_categories (id)
);
CREATE TABLE IF NOT EXISTS cotisations_membres
-- Enregistrement des cotisations et activités
(
id INTEGER NOT NULL PRIMARY KEY,
id_membre INTEGER NOT NULL REFERENCES membres (id) ON DELETE CASCADE,
id_cotisation INTEGER NOT NULL REFERENCES cotisations (id) ON DELETE CASCADE,
date TEXT NOT NULL DEFAULT CURRENT_DATE CHECK (date(date) IS NOT NULL AND date(date) = date)
);
CREATE UNIQUE INDEX IF NOT EXISTS cm_unique ON cotisations_membres (id_membre, id_cotisation, date);
CREATE TABLE IF NOT EXISTS membres_operations
-- Liaision des enregistrement des paiements en compta
(
id_membre INTEGER NOT NULL REFERENCES membres (id) ON DELETE CASCADE,
id_operation INTEGER NOT NULL REFERENCES compta_journal (id) ON DELETE CASCADE,
id_cotisation INTEGER NULL REFERENCES cotisations_membres (id) ON DELETE SET NULL,
PRIMARY KEY (id_membre, id_operation)
);
CREATE TABLE IF NOT EXISTS rappels
-- Rappels de devoir renouveller une cotisation
(
id INTEGER NOT NULL PRIMARY KEY,
id_cotisation INTEGER NOT NULL REFERENCES cotisations (id) ON DELETE CASCADE,
delai INTEGER NOT NULL, -- Délai en jours pour envoyer le rappel
sujet TEXT NOT NULL,
texte TEXT NOT NULL
);
CREATE TABLE IF NOT EXISTS rappels_envoyes
-- Enregistrement des rappels envoyés à qui et quand
(
id INTEGER NOT NULL PRIMARY KEY,
id_membre INTEGER NOT NULL REFERENCES membres (id) ON DELETE CASCADE,
id_cotisation INTEGER NOT NULL REFERENCES cotisations (id) ON DELETE CASCADE,
id_rappel INTEGER NULL REFERENCES rappels (id) ON DELETE CASCADE,
date TEXT NOT NULL DEFAULT CURRENT_DATE CHECK (date(date) IS NOT NULL AND date(date) = date),
media INTEGER NOT NULL -- Média utilisé pour le rappel : 1 = email, 2 = courrier, 3 = autre
);
--
|
︙ | | | ︙ | |
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
|
contenu TEXT NULL, -- Contenu de la dernière révision
FOREIGN KEY (id) REFERENCES wiki_pages(id)
);
CREATE TABLE IF NOT EXISTS wiki_revisions
-- Révisions du contenu des pages
(
id_page INTEGER NOT NULL,
revision INTEGER NULL,
id_auteur INTEGER NULL,
contenu TEXT NOT NULL,
modification TEXT NULL, -- Description des modifications effectuées
chiffrement INTEGER NOT NULL DEFAULT 0, -- 1 si le contenu est chiffré, 0 sinon
date TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP CHECK (datetime(date) IS NOT NULL AND datetime(date) = date),
PRIMARY KEY(id_page, revision),
FOREIGN KEY (id_page) REFERENCES wiki_pages (id), -- Clé externe obligatoire
FOREIGN KEY (id_auteur) REFERENCES membres (id) -- Clé externe non-obligatoire (peut être supprimée après en cas de suppression de membre)
);
CREATE INDEX IF NOT EXISTS wiki_revisions_id_page ON wiki_revisions (id_page);
CREATE INDEX IF NOT EXISTS wiki_revisions_id_auteur ON wiki_revisions (id_auteur);
-- Triggers pour synchro avec table wiki_pages
CREATE TRIGGER IF NOT EXISTS wiki_recherche_delete AFTER DELETE ON wiki_pages
|
|
|
|
<
<
|
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
|
contenu TEXT NULL, -- Contenu de la dernière révision
FOREIGN KEY (id) REFERENCES wiki_pages(id)
);
CREATE TABLE IF NOT EXISTS wiki_revisions
-- Révisions du contenu des pages
(
id_page INTEGER NOT NULL REFERENCES wiki_pages (id) ON DELETE CASCADE,
revision INTEGER NULL,
id_auteur INTEGER NULL REFERENCES membres (id) ON DELETE SET NULL,
contenu TEXT NOT NULL,
modification TEXT NULL, -- Description des modifications effectuées
chiffrement INTEGER NOT NULL DEFAULT 0, -- 1 si le contenu est chiffré, 0 sinon
date TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP CHECK (datetime(date) IS NOT NULL AND datetime(date) = date),
PRIMARY KEY(id_page, revision)
);
CREATE INDEX IF NOT EXISTS wiki_revisions_id_page ON wiki_revisions (id_page);
CREATE INDEX IF NOT EXISTS wiki_revisions_id_auteur ON wiki_revisions (id_auteur);
-- Triggers pour synchro avec table wiki_pages
CREATE TRIGGER IF NOT EXISTS wiki_recherche_delete AFTER DELETE ON wiki_pages
|
︙ | | | ︙ | |
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
|
id TEXT NOT NULL PRIMARY KEY,
banque TEXT NOT NULL,
iban TEXT NULL,
bic TEXT NULL,
FOREIGN KEY(id) REFERENCES compta_comptes(id)
);
CREATE TABLE IF NOT EXISTS compta_journal
-- Journal des opérations comptables
(
id INTEGER PRIMARY KEY,
|
|
|
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
|
id TEXT NOT NULL PRIMARY KEY,
banque TEXT NOT NULL,
iban TEXT NULL,
bic TEXT NULL,
FOREIGN KEY(id) REFERENCES compta_comptes(id) ON DELETE CASCADE
);
CREATE TABLE IF NOT EXISTS compta_journal
-- Journal des opérations comptables
(
id INTEGER PRIMARY KEY,
|
︙ | | | ︙ | |
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
|
id_auteur INTEGER NULL,
id_categorie INTEGER NULL, -- Numéro de catégorie (en mode simple)
FOREIGN KEY(moyen_paiement) REFERENCES compta_moyens_paiement(code),
FOREIGN KEY(compte_debit) REFERENCES compta_comptes(id),
FOREIGN KEY(compte_credit) REFERENCES compta_comptes(id),
FOREIGN KEY(id_exercice) REFERENCES compta_exercices(id),
FOREIGN KEY(id_auteur) REFERENCES membres(id),
FOREIGN KEY(id_categorie) REFERENCES compta_categories(id)
);
CREATE INDEX IF NOT EXISTS compta_operations_exercice ON compta_journal (id_exercice);
CREATE INDEX IF NOT EXISTS compta_operations_date ON compta_journal (date);
CREATE INDEX IF NOT EXISTS compta_operations_comptes ON compta_journal (compte_debit, compte_credit);
CREATE INDEX IF NOT EXISTS compta_operations_auteur ON compta_journal (id_auteur);
|
|
|
|
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
|
id_auteur INTEGER NULL,
id_categorie INTEGER NULL, -- Numéro de catégorie (en mode simple)
FOREIGN KEY(moyen_paiement) REFERENCES compta_moyens_paiement(code),
FOREIGN KEY(compte_debit) REFERENCES compta_comptes(id),
FOREIGN KEY(compte_credit) REFERENCES compta_comptes(id),
FOREIGN KEY(id_exercice) REFERENCES compta_exercices(id),
FOREIGN KEY(id_auteur) REFERENCES membres(id) ON DELETE SET NULL,
FOREIGN KEY(id_categorie) REFERENCES compta_categories(id) ON DELETE SET NULL
);
CREATE INDEX IF NOT EXISTS compta_operations_exercice ON compta_journal (id_exercice);
CREATE INDEX IF NOT EXISTS compta_operations_date ON compta_journal (date);
CREATE INDEX IF NOT EXISTS compta_operations_comptes ON compta_journal (compte_debit, compte_credit);
CREATE INDEX IF NOT EXISTS compta_operations_auteur ON compta_journal (id_auteur);
|
︙ | | | ︙ | |
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
|
type INTEGER NOT NULL DEFAULT 1, -- 1 = recette, -1 = dépense, 0 = autre (utilisé uniquement pour l'interface)
intitule TEXT NOT NULL,
description TEXT NULL,
compte TEXT NOT NULL, -- Compte affecté par cette catégorie
FOREIGN KEY(compte) REFERENCES compta_comptes(id)
);
CREATE TABLE IF NOT EXISTS plugins
(
id TEXT NOT NULL PRIMARY KEY,
officiel INTEGER NOT NULL DEFAULT 0,
nom TEXT NOT NULL,
|
|
|
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
|
type INTEGER NOT NULL DEFAULT 1, -- 1 = recette, -1 = dépense, 0 = autre (utilisé uniquement pour l'interface)
intitule TEXT NOT NULL,
description TEXT NULL,
compte TEXT NOT NULL, -- Compte affecté par cette catégorie
FOREIGN KEY(compte) REFERENCES compta_comptes(id) ON DELETE CASCADE
);
CREATE TABLE IF NOT EXISTS plugins
(
id TEXT NOT NULL PRIMARY KEY,
officiel INTEGER NOT NULL DEFAULT 0,
nom TEXT NOT NULL,
|
︙ | | | ︙ | |
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
|
callback TEXT NOT NULL,
PRIMARY KEY (signal, plugin)
);
CREATE TABLE IF NOT EXISTS compta_rapprochement
-- Rapprochement entre compta et relevés de comptes
(
id_operation INTEGER NOT NULL PRIMARY KEY REFERENCES compta_journal (id),
date TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP CHECK (datetime(date) IS NOT NULL AND datetime(date) = date),
id_auteur INTEGER NULL REFERENCES membres (id)
);
CREATE TABLE IF NOT EXISTS fichiers
-- Données sur les fichiers
(
id INTEGER NOT NULL PRIMARY KEY,
nom TEXT NOT NULL, -- nom de fichier (par exemple image1234.jpeg)
type TEXT NULL, -- Type MIME
image INTEGER NOT NULL DEFAULT 0, -- 1 = image reconnue
datetime TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP CHECK (datetime(datetime) IS NOT NULL AND datetime(datetime) = datetime), -- Date d'ajout ou mise à jour du fichier
id_contenu INTEGER NOT NULL REFERENCES fichiers_contenu (id)
);
CREATE INDEX IF NOT EXISTS fichiers_date ON fichiers (datetime);
CREATE TABLE IF NOT EXISTS fichiers_contenu
-- Contenu des fichiers
(
|
|
|
|
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
|
callback TEXT NOT NULL,
PRIMARY KEY (signal, plugin)
);
CREATE TABLE IF NOT EXISTS compta_rapprochement
-- Rapprochement entre compta et relevés de comptes
(
id_operation INTEGER NOT NULL PRIMARY KEY REFERENCES compta_journal (id) ON DELETE CASCADE,
date TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP CHECK (datetime(date) IS NOT NULL AND datetime(date) = date),
id_auteur INTEGER NULL REFERENCES membres (id)
);
CREATE TABLE IF NOT EXISTS fichiers
-- Données sur les fichiers
(
id INTEGER NOT NULL PRIMARY KEY,
nom TEXT NOT NULL, -- nom de fichier (par exemple image1234.jpeg)
type TEXT NULL, -- Type MIME
image INTEGER NOT NULL DEFAULT 0, -- 1 = image reconnue
datetime TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP CHECK (datetime(datetime) IS NOT NULL AND datetime(datetime) = datetime), -- Date d'ajout ou mise à jour du fichier
id_contenu INTEGER NOT NULL REFERENCES fichiers_contenu (id) ON DELETE CASCADE
);
CREATE INDEX IF NOT EXISTS fichiers_date ON fichiers (datetime);
CREATE TABLE IF NOT EXISTS fichiers_contenu
-- Contenu des fichiers
(
|
︙ | | | ︙ | |