Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
larssandergreen committed Jul 9, 2023
1 parent 14b4487 commit f524c87
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
13 changes: 11 additions & 2 deletions CRM/Volunteer/Upgrader.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function install() {
$this->schemaUpgrade20();
$this->addNeedEndDate();
$this->installNeedMetaDateFields();

// uncomment the next line to insert sample data
// $this->executeSqlFile('sql/volunteer_sample.mysql');
}
Expand Down Expand Up @@ -453,6 +453,15 @@ public function upgrade_2301() {
return TRUE;
}

/**
* Fix entity_table and entity_id which should not be required on project table
*/
public function upgrade_2302() {
$this->ctx->log->info('Applying update 2302 - Fix entity_table and entity_id which should not be required on project table');
CRM_Core_DAO::executeQuery('ALTER TABLE `civicrm_volunteer_project` MODIFY `entity_table` varchar(64) NULL, MODIFY `entity_id` int(10) NULL');
return TRUE;
}

public function uninstall() {
$customgroups = civicrm_api3('CustomGroup', 'get', [
'name' => ['IN' => [
Expand Down Expand Up @@ -499,7 +508,7 @@ public function uninstall() {
foreach (array_keys($optionvalues['values'] ?? []) as $optionvalue_id) {
civicrm_api3('OptionValue', 'delete', ['id' => $optionvalue_id]);
}

// Now delete the groups themselves.
foreach ($optiongroup_ids as $optiongroup_id) {
civicrm_api3('OptionGroup', 'delete', ['id' => $optiongroup_id]);
Expand Down
4 changes: 2 additions & 2 deletions xml/schema/CRM/Volunteer/Project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@
<name>entity_table</name>
<type>varchar</type>
<length>64</length>
<required>true</required>
<required>false</required>
<add>4.4</add>
<comment>Entity table for entity_id (initially civicrm_event)</comment>
</field>
<field>
<name>entity_id</name>
<type>int unsigned</type>
<required>true</required>
<required>false</required>
<add>4.4</add>
<comment>Implicit FK project entity (initially eventID).</comment>
</field>
Expand Down

0 comments on commit f524c87

Please sign in to comment.