Skip to content

Commit

Permalink
CRM: Fix migration error on sqlite (#39956)
Browse files Browse the repository at this point in the history
* Don't modify column on SQLite

* Bump defaults

* Add changelog
  • Loading branch information
tbradsha authored Oct 30, 2024
1 parent 60bef74 commit bd824ef
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Migrations: Improve WP Playground compatibility.
8 changes: 4 additions & 4 deletions projects/plugins/crm/includes/ZeroBSCRM.Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,13 @@ function zeroBSCRM_createTables(){
`zbsc_lname` VARCHAR(100) NULL,
`zbsc_addr1` VARCHAR(200) NULL,
`zbsc_addr2` VARCHAR(200) NULL,
`zbsc_city` VARCHAR(100) NULL,
`zbsc_city` VARCHAR(200) NULL,
`zbsc_county` VARCHAR(200) NULL,
`zbsc_country` VARCHAR(200) NULL,
`zbsc_postcode` VARCHAR(50) NULL,
`zbsc_secaddr1` VARCHAR(200) NULL,
`zbsc_secaddr2` VARCHAR(200) NULL,
`zbsc_seccity` VARCHAR(100) NULL,
`zbsc_seccity` VARCHAR(200) NULL,
`zbsc_seccounty` VARCHAR(200) NULL,
`zbsc_seccountry` VARCHAR(200) NULL,
`zbsc_secpostcode` VARCHAR(50) NULL,
Expand Down Expand Up @@ -558,13 +558,13 @@ function zeroBSCRM_createTables(){
`zbsco_email` VARCHAR(200) NULL DEFAULT NULL,
`zbsco_addr1` VARCHAR(200) NULL DEFAULT NULL,
`zbsco_addr2` VARCHAR(200) NULL DEFAULT NULL,
`zbsco_city` VARCHAR(100) NULL DEFAULT NULL,
`zbsco_city` VARCHAR(200) NULL DEFAULT NULL,
`zbsco_county` VARCHAR(200) NULL DEFAULT NULL,
`zbsco_country` VARCHAR(200) NULL DEFAULT NULL,
`zbsco_postcode` VARCHAR(50) NULL DEFAULT NULL,
`zbsco_secaddr1` VARCHAR(200) NULL DEFAULT NULL,
`zbsco_secaddr2` VARCHAR(200) NULL DEFAULT NULL,
`zbsco_seccity` VARCHAR(100) NULL DEFAULT NULL,
`zbsco_seccity` VARCHAR(200) NULL DEFAULT NULL,
`zbsco_seccounty` VARCHAR(200) NULL DEFAULT NULL,
`zbsco_seccountry` VARCHAR(200) NULL DEFAULT NULL,
`zbsco_secpostcode` VARCHAR(50) NULL DEFAULT NULL,
Expand Down
7 changes: 7 additions & 0 deletions projects/plugins/crm/includes/ZeroBSCRM.Migrations.php
Original file line number Diff line number Diff line change
Expand Up @@ -1254,6 +1254,13 @@ function zeroBSCRM_migration_invoice_language_fixes() {
* From Gh Issue 3465, this migration increases the city field size to 200 chars
*/
function zeroBSCRM_migration_gh3465_increase_city_field_size() {

// SQLite doesn't support column modification.
$db_engine = jpcrm_database_engine();
if ( $db_engine === 'sqlite' ) {
return;
}

global $wpdb, $ZBSCRM_t; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase

$sql = 'ALTER TABLE ' . $ZBSCRM_t['contacts'] . ' MODIFY COLUMN `zbsc_city` VARCHAR(200);'; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase
Expand Down

0 comments on commit bd824ef

Please sign in to comment.