63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
CREATE TABLE IF NOT EXISTS services_users
-- Enregistrement des cotisations et activités
(
id INTEGER NOT NULL PRIMARY KEY,
id_user INTEGER NOT NULL REFERENCES membres (id) ON DELETE CASCADE,
id_service INTEGER NOT NULL REFERENCES services (id) ON DELETE CASCADE,
id_fee INTEGER NULL REFERENCES services_fee (id) ON DELETE CASCADE,
paid INTEGER NOT NULL DEFAULT 0,
expiry_date TEXT NULL DEFAULT CURRENT_DATE CHECK (date(expiry_date) IS NOT NULL AND date(expiry_date) = expiry_date)
);
CREATE UNIQUE INDEX IF NOT EXISTS su_unique ON services_users (id_user, id_service, expiry_date);
|
|
|
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
CREATE TABLE IF NOT EXISTS services_users
-- Enregistrement des cotisations et activités
(
id INTEGER NOT NULL PRIMARY KEY,
id_user INTEGER NOT NULL REFERENCES membres (id) ON DELETE CASCADE,
id_service INTEGER NOT NULL REFERENCES services (id) ON DELETE CASCADE,
id_fee INTEGER NULL REFERENCES services_fees (id) ON DELETE CASCADE,
paid INTEGER NOT NULL DEFAULT 0,
expiry_date TEXT NULL DEFAULT CURRENT_DATE CHECK (date(expiry_date) IS NOT NULL AND date(expiry_date) = expiry_date)
);
CREATE UNIQUE INDEX IF NOT EXISTS su_unique ON services_users (id_user, id_service, expiry_date);
|