Navigation - Make required fields NOT NULL
authorColeman Watts <coleman@civicrm.org>
Sun, 9 Jan 2022 02:51:03 +0000 (21:51 -0500)
committerColeman Watts <coleman@civicrm.org>
Sun, 9 Jan 2022 02:55:02 +0000 (21:55 -0500)
CRM/Core/DAO/Navigation.php
CRM/Upgrade/Incremental/sql/5.47.alpha1.mysql.tpl
xml/schema/Core/Navigation.xml

index f57b5fe09823e372b39b21298310271ac81a8df5..3b60e5d2ca4563817b6f812a20eeaf3e6425254d 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/Navigation.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:6400fef9c925231f0d6245030ec46e68)
+ * (GenCodeChecksum:a26cb263ead3cb0d9bb3f0fda7fbec3c)
  */
 
 /**
@@ -316,7 +316,9 @@ class CRM_Core_DAO_Navigation extends CRM_Core_DAO {
           'type' => CRM_Utils_Type::T_BOOLEAN,
           'title' => ts('Is Active'),
           'description' => ts('Is this navigation item active?'),
+          'required' => TRUE,
           'where' => 'civicrm_navigation.is_active',
+          'default' => '1',
           'table_name' => 'civicrm_navigation',
           'entity' => 'Navigation',
           'bao' => 'CRM_Core_BAO_Navigation',
@@ -344,7 +346,9 @@ class CRM_Core_DAO_Navigation extends CRM_Core_DAO {
           'type' => CRM_Utils_Type::T_INT,
           'title' => ts('Order'),
           'description' => ts('Ordering of the navigation items in various blocks.'),
+          'required' => TRUE,
           'where' => 'civicrm_navigation.weight',
+          'default' => '0',
           'table_name' => 'civicrm_navigation',
           'entity' => 'Navigation',
           'bao' => 'CRM_Core_BAO_Navigation',
index 83d347868b84d63fc89502b82c000898be03b3aa..dd955c3e3241988abd87881daae8b9c7627f6b8c 100644 (file)
@@ -1 +1,7 @@
 {* file to handle db changes in 5.47.alpha1 during upgrade *}
+
+UPDATE `civicrm_navigation` SET `is_active` = 0 WHERE `is_active` IS NULL;
+UPDATE `civicrm_navigation` SET `weight` = 0 WHERE `weight` IS NULL;
+ALTER TABLE `civicrm_navigation`
+  MODIFY COLUMN `is_active` tinyint NOT NULL DEFAULT 1 COMMENT 'Is this navigation item active?',
+  MODIFY COLUMN `weight` int NOT NULL DEFAULT 0 COMMENT 'Ordering of the navigation items in various blocks.';
index dd489e66e00cfe70c68f54bb28e9361af4a46532..bb97737ad3729661ea4cc24d3e54557d10157304 100644 (file)
     <title>Is Active</title>
     <type>boolean</type>
     <comment>Is this navigation item active?</comment>
+    <default>1</default>
+    <required>true</required>
     <add>3.0</add>
   </field>
   <field>
     <title>Order</title>
     <type>int</type>
     <comment>Ordering of the navigation items in various blocks.</comment>
+    <default>0</default>
+    <required>true</required>
     <add>3.0</add>
   </field>
 </table>