1 CREATE TABLE cotisations
2 -- Types de cotisations et activités
4 id INTEGER PRIMARY KEY,
5 id_categorie_compta
INTEGER NULL, -- NULL si le type n'est pas associé automatiquement à la compta
7 intitule
TEXT NOT NULL,
11 duree
INTEGER NULL, -- En jours
12 debut
TEXT NULL, -- timestamp
15 FOREIGN KEY (id_categorie_compta
) REFERENCES compta_categories (id)
18 CREATE TABLE cotisations_membres
19 -- Enregistrement des cotisations et activités
21 id INTEGER NOT NULL PRIMARY KEY,
22 id_membre
INTEGER NOT NULL REFERENCES membres (id),
23 id_cotisation
INTEGER NOT NULL REFERENCES cotisations (id),
25 date TEXT NOT NULL DEFAULT CURRENT_DATE
28 CREATE UNIQUE INDEX cm_unique
ON cotisations_membres (id_membre
, id_cotisation
, date);
30 CREATE TABLE membres_operations
31 -- Liaision des enregistrement des paiements en compta
33 id_membre
INTEGER NOT NULL REFERENCES membres (id),
34 id_operation
INTEGER NOT NULL REFERENCES compta_journal (id),
35 id_cotisation
INTEGER NULL REFERENCES cotisations_membres (id),
37 PRIMARY KEY (id_membre
, id_operation
)
41 -- Rappels de devoir renouveller une cotisation
43 id INTEGER PRIMARY KEY,
44 id_cotisation
INTEGER NOT NULL REFERENCES cotisations (id),
46 delai
INTEGER NOT NULL, -- Délai en jours pour envoyer le rappel
52 CREATE TABLE rappels_envoyes
53 -- Enregistrement des rappels envoyés à qui et quand
55 id INTEGER PRIMARY KEY,
57 id_membre
INTEGER NOT NULL REFERENCES membres (id),
58 id_cotisation
INTEGER NOT NULL REFERENCES cotisations (id),
60 date TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
62 media
INTEGER NOT NULL -- Média utilisé pour le rappel : 1 = email, 2 = courrier, 3 = autre
66 -- Plugins / extensions
69 officiel
INTEGER NOT NULL DEFAULT 0,
74 version TEXT NOT NULL,
75 menu
INTEGER NOT NULL DEFAULT 0,
79 -- Mise à jour des catégories
81 CREATE TABLE membres_categories_tmp
82 -- Catégories de membres
84 id INTEGER PRIMARY KEY,
88 droit_wiki
INT DEFAULT 1,
89 droit_membres
INT DEFAULT 1,
90 droit_compta
INT DEFAULT 1,
91 droit_inscription
INT DEFAULT 0,
92 droit_connexion
INT DEFAULT 1,
93 droit_config
INT DEFAULT 0,
96 id_cotisation_obligatoire
INTEGER NULL REFERENCES cotisations (id)
99 -- Remise des anciennes infos
100 INSERT INTO membres_categories_tmp
SELECT id, nom
, description
, droit_wiki
, droit_membres
,
101 droit_compta
, droit_inscription
, droit_connexion
, droit_config
, cacher
, NULL FROM membres_categories
;
103 -- Suppression de l'ancienne table et renommage de la nouvelle
104 DROP TABLE membres_categories
;
105 ALTER TABLE membres_categories_tmp
RENAME TO membres_categories
;
107 -- Ajout désactivation compte
108 ALTER TABLE compta_comptes
ADD COLUMN desactive
INTEGER NOT NULL DEFAULT 0;
110 PRAGMA foreign_keys
= ON;