WHMCS Upgrade Error tblcreditcards

0
234
whmcs

I’ve been dealing with the automatic upgrade of WHMCS from 7.7 to 7.8 and I kept getting an error message about tblcreditcards:


Oops!
Something went wrong and we couldn't process your request.
Please go back to the previous page and try again.

If the problem persists, please contact us.

For additional assistance, please reference the WHMCS TroubleShooting Guide »

PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'tblcreditcards.deleted_at' in 'where clause' in /public_html/vendor/illuminate/database/Connection.php:333
Stack trace:
#0 /public_html/vendor/illuminate/database/Connection.php(333): PDO->prepare('select distinct...')
#1 /public_html/vendor/illuminate/database/Connection.php(706): Illuminate\Database\Connection->Illuminate\Database\{closure}(Object(Illuminate\Database\MySqlConnection), 'select distinct...', Array)
#2 /public_html/vendor/illuminate/database/Connection.php(669): Illuminate\Database\Connection->runQueryCallback('select distinct...', Array, Object(Closure))
#3 /vendor/illuminate/database/Connection.php(342): Illuminate\Database\Connection->run('select distinct...', Array, Object(Closure))
#4 /public_html/vendor/illuminate/database/Query/Builder.php(1583): Illuminate\Database\Connection->select('select distinct...', Array, true)
#5 /public_html/vendor/illuminate/database/Query/Builder.php(1569): Illuminate\Database\Query\Builder->runSelect()
#6 /public_html/vendor/illuminate/database/Query/Builder.php(1813): Illuminate\Database\Query\Builder->get(Array)
#7 /public_html/vendor/illuminate/database/Eloquent/Builder.php(442): Illuminate\Database\Query\Builder->pluck('card_type', NULL)
#8 /public_html/vendor/whmcs/whmcs-foundation/lib/User/Client.php(0): Illuminate\Database\Eloquent\Builder->pluck('card_type')
#9 /public_html/admin/clients.php(0): WHMCS\User\Client::getUsedCardTypes()
#10 {main}
Next Illuminate\Database\QueryException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'tblcreditcards.deleted_at' in 'where clause' (SQL: select distinct `card_type` from `tblcreditcards` where `card_type` != and `tblcreditcards`.`deleted_at` is null) in /public_html/vendor/illuminate/database/Connection.php:713
Stack trace:
#0 /public_html/vendor/illuminate/database/Connection.php(669): Illuminate\Database\Connection->runQueryCallback('select distinct...', Array, Object(Closure))
#1 /public_html/vendor/illuminate/database/Connection.php(342): Illuminate\Database\Connection->run('select distinct...', Array, Object(Closure))
#2 /public_html/vendor/illuminate/database/Query/Builder.php(1583): Illuminate\Database\Connection->select('select distinct...', Array, true)
#3 /public_html/vendor/illuminate/database/Query/Builder.php(1569): Illuminate\Database\Query\Builder->runSelect()
#4 /public_html/vendor/illuminate/database/Query/Builder.php(1813): Illuminate\Database\Query\Builder->get(Array)
#5 /public_html/vendor/illuminate/database/Eloquent/Builder.php(442): Illuminate\Database\Query\Builder->pluck('card_type', NULL)
#6 /public_html/vendor/whmcs/whmcs-foundation/lib/User/Client.php(0): Illuminate\Database\Eloquent\Builder->pluck('card_type')
#7 /public_html/admin/clients.php(0): WHMCS\User\Client::getUsedCardTypes()
#8 {main}

Instead of doing a database/file restore again, I decided to just create the table and the columns myself. The process was create the table, add the column, see if it worked, if not, add the next column until the error messages go away. It worked. But I still couldn’t sleep knowing that what I made wasn’t right. I was just throwing columns without proper datatypes to see what stuck. In the end, I contacted WHMCS support and they gave me this code for the tblcreditcards table.

CREATE TABLE IF NOT EXISTS `tblcreditcards` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `pay_method_id` int(11) NOT NULL DEFAULT '0',
  `card_type` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `last_four` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `expiry_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `card_data` blob NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `deleted_at` timestamp NULL,
  PRIMARY KEY (`id`),
  KEY `tblcreditcards_pay_method_id` (`pay_method_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

WHMCS support is very responsive and amazing! So glad I went with them.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.