*
* Generated from xml/schema/CRM/Core/Note.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:aa7f2dd9a225bafdc5c551d869dfae8a)
+ * (GenCodeChecksum:c04c2c1404af638e1adf973fe845d0ac)
*/
/**
/**
* Foreign Key to Note Privacy Level (which is an option value pair and hence an implicit FK)
*
- * @var string|null
+ * @var string
* (SQL type: varchar(255))
* Note that values will be retrieved from the database as a string.
*/
'type' => CRM_Utils_Type::T_STRING,
'title' => ts('Privacy'),
'description' => ts('Foreign Key to Note Privacy Level (which is an option value pair and hence an implicit FK)'),
+ 'required' => TRUE,
'maxlength' => 255,
'size' => CRM_Utils_Type::HUGE,
'usage' => [
'token' => FALSE,
],
'where' => 'civicrm_note.privacy',
+ 'default' => '0',
'table_name' => 'civicrm_note',
'entity' => 'Note',
'bao' => 'CRM_Core_BAO_Note',
*/
public function upgrade_5_67_alpha1($rev): void {
$this->addTask(ts('Upgrade DB to %1: SQL', [1 => $rev]), 'runSql', $rev);
+ $this->addTask('Make Note.privacy required', 'alterColumn', 'civicrm_note', 'privacy', "varchar(255) NOT NULL DEFAULT 0 COMMENT 'Foreign Key to Note Privacy Level (which is an option value pair and hence an implicit FK)'");
$this->addTask('Make EntityFile.entity_table required', 'alterColumn', 'civicrm_entity_file', 'entity_table', "varchar(64) NOT NULL COMMENT 'physical tablename for entity being joined to file, e.g. civicrm_contact'");
$this->addExtensionTask('Enable Authx extension', ['authx'], 1101);
$this->addExtensionTask('Enable Afform extension', ['org.civicrm.afform'], 1102);
{* file to handle db changes in 5.67.alpha1 during upgrade *}
+UPDATE civicrm_note SET privacy = 0 WHERE privacy IS NULL;
+
{* NULL values would be nonsensical and useless - no reason to keep them *}
DELETE FROM civicrm_entity_file WHERE entity_table IS NULL;
<length>255</length>
<comment>Foreign Key to Note Privacy Level (which is an option value pair and hence an implicit FK)</comment>
<add>3.3</add>
+ <required>true</required>
+ <default>0</default>
<html>
<type>Select</type>
</html>