262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
|
id_creator INTEGER NULL REFERENCES membres(id) ON DELETE SET NULL,
id_related INTEGER NULL REFERENCES acc_transactions(id) ON DELETE SET NULL -- écriture liée (par ex. remboursement d'une dette)
);
CREATE INDEX IF NOT EXISTS acc_transactions_year ON acc_transactions (id_year);
CREATE INDEX IF NOT EXISTS acc_transactions_date ON acc_transactions (date);
CREATE INDEX IF NOT EXISTS acc_transactions_related ON acc_transactions (id_related);
CREATE INDEX IF NOT EXISTS acc_transactions_type ON acc_transactions (type);
CREATE INDEX IF NOT EXISTS acc_transactions_status ON acc_transactions (status);
CREATE TABLE IF NOT EXISTS acc_transactions_lines
-- Lignes d'écritures d'une opération
(
id INTEGER PRIMARY KEY NOT NULL,
|
|
|
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
|
id_creator INTEGER NULL REFERENCES membres(id) ON DELETE SET NULL,
id_related INTEGER NULL REFERENCES acc_transactions(id) ON DELETE SET NULL -- écriture liée (par ex. remboursement d'une dette)
);
CREATE INDEX IF NOT EXISTS acc_transactions_year ON acc_transactions (id_year);
CREATE INDEX IF NOT EXISTS acc_transactions_date ON acc_transactions (date);
CREATE INDEX IF NOT EXISTS acc_transactions_related ON acc_transactions (id_related);
CREATE INDEX IF NOT EXISTS acc_transactions_type ON acc_transactions (type, id_year);
CREATE INDEX IF NOT EXISTS acc_transactions_status ON acc_transactions (status);
CREATE TABLE IF NOT EXISTS acc_transactions_lines
-- Lignes d'écritures d'une opération
(
id INTEGER PRIMARY KEY NOT NULL,
|
287
288
289
290
291
292
293
294
295
296
297
298
299
300
|
id_analytical INTEGER NULL REFERENCES acc_accounts(id) ON DELETE SET NULL,
CONSTRAINT line_check1 CHECK ((credit * debit) = 0),
CONSTRAINT line_check2 CHECK ((credit + debit) > 0)
);
CREATE INDEX IF NOT EXISTS acc_transactions_lines_account ON acc_transactions_lines (id_account);
CREATE INDEX IF NOT EXISTS acc_transactions_lines_analytical ON acc_transactions_lines (id_analytical);
CREATE INDEX IF NOT EXISTS acc_transactions_lines_reconciled ON acc_transactions_lines (reconciled);
CREATE TABLE IF NOT EXISTS acc_transactions_users
-- Liaison des écritures et des membres
(
|
>
|
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
|
id_analytical INTEGER NULL REFERENCES acc_accounts(id) ON DELETE SET NULL,
CONSTRAINT line_check1 CHECK ((credit * debit) = 0),
CONSTRAINT line_check2 CHECK ((credit + debit) > 0)
);
CREATE INDEX IF NOT EXISTS acc_transactions_lines_transaction ON acc_transactions_lines (id_transaction);
CREATE INDEX IF NOT EXISTS acc_transactions_lines_account ON acc_transactions_lines (id_account);
CREATE INDEX IF NOT EXISTS acc_transactions_lines_analytical ON acc_transactions_lines (id_analytical);
CREATE INDEX IF NOT EXISTS acc_transactions_lines_reconciled ON acc_transactions_lines (reconciled);
CREATE TABLE IF NOT EXISTS acc_transactions_users
-- Liaison des écritures et des membres
(
|