Overview
Comment:Fix old services with wrong dates
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev | 1.0.0-rc5
Files: files | file ages | folders
SHA1: 9b1179a6fbae2456582220d76338eba2f1e7b79b
User & Date: bohwaz on 2020-12-04 20:24:36
Other Links: branch diff | manifest | tags
Context
2020-12-04
23:59
Fix mixed content when WWW_URL is http and ADMIN_URL is https check-in: 7685aa1f87 user: bohwaz tags: dev
20:24
Fix old services with wrong dates check-in: 9b1179a6fb user: bohwaz tags: dev, 1.0.0-rc5
19:27
Make sure we don't get sent reminders linked to no reminder (weird) check-in: 4bd0ced0d8 user: bohwaz tags: dev
Changes

Modified src/include/data/1.0.0_migration.sql from [07aa571373] to [ba81ccc806].

122
123
124
125
126
127
128



129
130
131
132
133
134
135

DROP TABLE membres_categories_old;

-- Transfert des rapprochements
UPDATE acc_transactions_lines SET reconciled = 1 WHERE id_transaction IN (SELECT id_operation FROM compta_rapprochement);

--------- MIGRATION COTISATIONS ----------




INSERT INTO services SELECT id, intitule, description, duree, debut, fin FROM cotisations;

INSERT INTO services_fees (id, label, amount, id_service, id_account, id_year)
	SELECT id, intitule, CASE WHEN montant IS NOT NULL THEN CAST(montant*100 AS integer) ELSE NULL END, id,
		(SELECT id FROM acc_accounts WHERE code = (SELECT compte FROM compta_categories WHERE id = id_categorie_compta)),
		(SELECT MAX(id) FROM acc_years WHERE closed = 0)







>
>
>







122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138

DROP TABLE membres_categories_old;

-- Transfert des rapprochements
UPDATE acc_transactions_lines SET reconciled = 1 WHERE id_transaction IN (SELECT id_operation FROM compta_rapprochement);

--------- MIGRATION COTISATIONS ----------

-- A edge-case where the end date is after the start date, let's fix it…
UPDATE cotisations SET fin = debut WHERE fin < debut;

INSERT INTO services SELECT id, intitule, description, duree, debut, fin FROM cotisations;

INSERT INTO services_fees (id, label, amount, id_service, id_account, id_year)
	SELECT id, intitule, CASE WHEN montant IS NOT NULL THEN CAST(montant*100 AS integer) ELSE NULL END, id,
		(SELECT id FROM acc_accounts WHERE code = (SELECT compte FROM compta_categories WHERE id = id_categorie_compta)),
		(SELECT MAX(id) FROM acc_years WHERE closed = 0)