Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After Upgrade Unknown column 'contact_id' in 'where clause' #268

Open
hair-transplant opened this issue Jan 3, 2019 · 1 comment
Open

Comments

@hair-transplant
Copy link

Joomla Version
CiviCRM 5.8.2.
Stripe version 5.2.
After upgrade both to most recent version

` [callback] => Array
(
[0] => CRM_Core_Error
[1] => handle
)

[code] => -19
[message] => DB Error: no such field
[mode] => 16
[debug_info] => SELECT id
  FROM civicrm_stripe_customers
  WHERE contact_id = '363' AND is_live = 1 AND processor_id = 5 [nativecode=1054 ** Unknown column 'contact_id' in 'where clause']
[type] => DB_Error
[user_info] => SELECT id
  FROM civicrm_stripe_customers
  WHERE contact_id = '363' AND is_live = 1 AND processor_id = 5 [nativecode=1054 ** Unknown column 'contact_id' in 'where clause']
[to_string] => [db_error: message="DB Error: no such field" code=-19 mode=callback callback=CRM_Core_Error::handle prefix="" info="SELECT id
  FROM civicrm_stripe_customers
  WHERE contact_id = '363' AND is_live = 1 AND processor_id = 5 [nativecode=1054 ** Unknown column 'contact_id' in 'where clause']"]

)`

I manually added SQL Statements from this upgrade

public function upgrade_5010() { $this->ctx->log->info('Applying Stripe update 5010. Adding contact_id to civicrm_stripe_customers.'); if (!CRM_Core_BAO_SchemaHandler::checkIfFieldExists('civicrm_stripe_customers', 'contact_id', FALSE)) { CRM_Core_DAO::executeQuery('ALTER TABLE civicrm_stripe_customers ADD COLUMNcontact_idint(10) UNSIGNED DEFAULT NULL COMMENT "FK ID from civicrm_contact"'); CRM_Core_DAO::executeQuery('ALTER TABLEcivicrm_stripe_customers ADD CONSTRAINTFK_civicrm_stripe_customers_contact_id FOREIGN KEY (contact_id) REFERENCES civicrm_contact (id`) ON DELETE CASCADE;');
}

`

Then error
[debug] Stripe Payment Error: Payment Response: <br />Type: invalid_request_error<br />Code: resource_missing<br />Message: No such token: Stripe Token<br />

``

So not working at all anymore AFTER this upgrade

@mattwire
Copy link
Contributor

mattwire commented Jan 4, 2019

You shouldn't need to add any manual steps for upgrade - there are 3 upgraders that run between 5.0 and 5.2 and do everything for you. The only way I can see it going wrong is if you were using a development version in between 5.0 and 5.2, or upgrading directly from a 4.x version to 5.2 without installing 5.0 first. You should manually check that your database matches what is in the auto_install.sql file of the extension. If you need to run the upgrader steps to manipulate the actual data contained in the tables there are two API functions detailed in the docs - https://lab.civicrm.org/extensions/stripe/blob/master/docs/api.md#additionally-for-upgrading

If you still think there is an issue please open a new issue at https://lab.civicrm.org/extensions/stripe/issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants