ushahidi / Ushahidi_Web

Ushahidi v2. A platform that allows information collection, visualization and interactive mapping, allowing anyone to submit information through text messaging using a mobile phone, email or web form.
http://www.ushahidi.com
Other
901 stars 624 forks source link

Modify Ushahidi DB Schema - Allow for FK/cascade WRT custom forms #720

Open pdestefanis opened 12 years ago

pdestefanis commented 12 years ago

Currently, when a form or incident is deleted, its custom form-related records are orphaned. Could we implement FK's to deal wiht them?

What I believe is needed:

Convert the following tables to InnoDB:

incident form form_field form_field_option form_response

ALTER TABLE form_field ADD CONSTRAINT FK_form_id FOREIGN KEY FK_form_field_1 (form_id) REFERENCES form (id) ON DELETE CASCADE ON UPDATE CASCADE , ROW_FORMAT = DYNAMIC;

ALTER TABLE form_response ADD CONSTRAINT FK_incident FOREIGN KEY FK_form_response_2 (incident_id) REFERENCES incident (id) ON DELETE CASCADE ON UPDATE CASCADE , ROW_FORMAT = DYNAMIC;

ALTER TABLE form_responseADD CONSTRAINTFK_form_fieldFOREIGN KEYFK_form_response_1(form_field_id) REFERENCESform_field(id`) ON DELETE CASCADE ON UPDATE CASCADE , ROW_FORMAT = DYNAMIC;

ALTER TABLE form_field_option ADD CONSTRAINT FK_form_field_option_1 FOREIGN KEY FK_form_field_option_1 (form_field_id) REFERENCES form_field (id) ON DELETE CASCADE ON UPDATE CASCADE , ROW_FORMAT = DYNAMIC;

kamaulynder commented 11 years ago

Better way of handling custom forms is a key feature on 3.0.