tbar0970 / jethro-pmm

Jethro Pastoral Ministry Manager
GNU General Public License v3.0
36 stars 26 forks source link

_person_group table not created on new installation #43

Closed wom-bat closed 9 years ago

wom-bat commented 9 years ago

On a nice shiny new empty database, I fill in the initial user form, and then I see:

_doQuery: [Error message: Could not execute statement]
 [Last executed query:
     CREATE TABLE person_group_headcount ( `date` DATE NOT NULL, `person_groupid`     INT(11) NOT NULL, `number` INT(11) NOT NULL, PRIMARY KEY (`date`, `person_groupid`), CONSTRAINT FOREIGN KEY (`person_groupid`) REFERENCES `_person_group` (`id`) ) Engine=InnoDB;] [Native code: 1005] [Native message: Can't create table 'jethroch_jethro.person_group_headcount' (errno: 150)]

This is because the _person_group table does not yet exist. I can't find in the source where it is meant to be created.

mysql> show tables;
+--------------------------------+
| Tables_in_jethroch_jethro      |
+--------------------------------+
| abstract_note                  |
| action_plan                    |
| attendance_record              |
| congregation                   |
| congregation_headcount         |
| congregation_service_component |
| family                         |
| family_note                    |
+--------------------------------+
8 rows in set (0.00 sec)
tbar0970 commented 9 years ago

Thanks for reporting. This is a problem with the order the tables are created in. It really needs to wait til the end before creating foreign keys. Pity I didn't spot this earlier. Will fix shortly.

wom-bat commented 9 years ago

Where is the table created? The only creating reference I can find to _person_group is in the upgrade scripts, where it's renamed from person_group on the 2011 upgrade.

tbar0970 commented 9 years ago

It's created via person_group::getInitSQL() (db_objects/person_group.class.php). Fix coming in the next release later today.

tbar0970 commented 9 years ago

Fix released in v2.10.2