Moving to GitHub.
[platal.git] / upgrade / 1.1.2 / 02_payments.sql
CommitLineData
a7c0d514
DB
1ALTER TABLE payment_transactions ADD method_id INTEGER DEFAULT NULL AFTER id; # NULL if not initiated from the site
2ALTER TABLE payment_transactions CHANGE timestamp ts_confirmed DATETIME DEFAULT NULL; # NULL = not confirmed
3ALTER TABLE payment_transactions ADD ts_initiated DATETIME DEFAULT NULL AFTER ts_confirmed; # NULL = not initiated
4ALTER TABLE payment_transactions CHANGE amount amount_tmp VARCHAR(15);
5ALTER TABLE payment_transactions ADD amount DECIMAL(9,2) NOT NULL AFTER amount_tmp; # only local currency allowed (EUR)
6ALTER TABLE payment_transactions ADD commission DECIMAL(9,2) DEFAULT NULL AFTER amount;
7ALTER TABLE payment_transactions ADD status ENUM('confirmed','pending','canceled') NOT NULL DEFAULT 'pending';
8ALTER TABLE payment_transactions ADD recon_id INTEGER DEFAULT NULL; # NULL = not reconciliated
9UPDATE payment_transactions SET method_id = 0 WHERE length(id)=7;
10UPDATE payment_transactions SET method_id = 1 WHERE length(id)=15 OR length(id)=17;
11UPDATE payment_transactions SET method_id = 2 WHERE length(id)=14;
12UPDATE payment_transactions SET status = 'confirmed';
13UPDATE payment_transactions SET amount=CONVERT(REPLACE(REPLACE(amount_tmp," EUR",""),",","."),DECIMAL(9,2));
14ALTER TABLE payment_transactions ADD KEY method_id (method_id);
15ALTER TABLE payment_transactions ADD KEY ref (ref);
16# ALTER TABLE payment_transactions ADD UNIQUE KEY fullref (fullref);
17#fullref dupliqués :
18#select t1.* from payment_transactions as t1 join payment_transactions as t2 using(fullref) group by(t1.id) having count(*)!=1 order by fullref;
19ALTER TABLE payment_transactions DROP amount_tmp;
20
fbb196fa 21ALTER TABLE payment_transactions ADD COLUMN display BOOL NOT NULL DEFAULT FALSE;
a7c0d514 22ALTER TABLE payments MODIFY COLUMN flags SET('unique', 'old', 'donation') NOT NULL DEFAULT '';
f85d5739
SJ
23
24-- vim:set syntax=mysql:
a7c0d514 25