{* file to handle db changes in 4.6.3 during upgrade *}
-
---
+--
-- CRM-16367: adding the shared payment token table
--
-CREATE TABLE `civicrm_payment_token` (
+CREATE TABLE IF NOT EXISTS `civicrm_payment_token` (
`id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'Payment Token ID',
`contact_id` int unsigned NOT NULL COMMENT 'FK to Contact ID for the owner of the token',
`billing_middle_name` varchar(255) COMMENT 'Billing middle name at the time of token creation. Useful for fraud forensics',
`billing_last_name` varchar(255) COMMENT 'Billing last name at the time of token creation. Useful for fraud forensics',
`masked_account_number` varchar(255) COMMENT 'Holds the part of the card number or account details that may be retained or displayed',
- `ip_address` varchar(255) COMMENT 'IP used when creating the token. Useful for fraud forensics',
- PRIMARY KEY ( `id` ),
- CONSTRAINT FK_civicrm_payment_token_contact_id FOREIGN KEY (`contact_id`)
- REFERENCES `civicrm_contact`(`id`) ON DELETE CASCADE,
- CONSTRAINT FK_civicrm_payment_token_payment_processor_id FOREIGN KEY (`payment_processor_id`)
- REFERENCES `civicrm_payment_processor`(`id`) ON DELETE RESTRICT,
- CONSTRAINT FK_civicrm_payment_token_created_id FOREIGN KEY (`created_id`)
+ `ip_address` varchar(255) COMMENT 'IP used when creating the token. Useful for fraud forensics' ,
+ PRIMARY KEY ( `id` ),
+ CONSTRAINT FK_civicrm_payment_token_contact_id FOREIGN KEY (`contact_id`)
+ REFERENCES `civicrm_contact`(`id`) ON DELETE CASCADE,
+ CONSTRAINT FK_civicrm_payment_token_payment_processor_id FOREIGN KEY (`payment_processor_id`)
+ REFERENCES `civicrm_payment_processor`(`id`) ON DELETE RESTRICT,
+ CONSTRAINT FK_civicrm_payment_token_created_id FOREIGN KEY (`created_id`)
REFERENCES `civicrm_contact`(`id`) ON DELETE SET NULL
-
-) ENGINE=InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
-
+)
+ENGINE=InnoDB DEFAULT
+CHARACTER SET utf8
+COLLATE utf8_unicode_ci;
<class>PaymentToken</class>
<name>civicrm_payment_token</name>
<comment>Payment Token</comment>
- <add>4.7</add>
+ <add>4.6</add>
<field>
- <name>id</name>
+ <name>id</name>
+ <uniqueName>payment_token_id</uniqueName>
+ <title>Payment Token ID</title>
<type>int unsigned</type>
<required>true</required>
<comment>Payment Token ID</comment>
- <add>4.7</add>
+ <add>4.6</add>
</field>
<primaryKey>
<name>id</name>
<type>int unsigned</type>
<required>true</required>
<comment>FK to Contact ID for the owner of the token</comment>
- <add>4.7</add>
+ <add>4.6</add>
</field>
<foreignKey>
<name>contact_id</name>
<table>civicrm_contact</table>
<key>id</key>
- <add>4.7</add>
+ <add>4.6</add>
<onDelete>CASCADE</onDelete>
</foreignKey>
<field>
<type>int unsigned</type>
<required>true</required>
<comment></comment>
- <add>4.7</add>
+ <add>4.6</add>
</field>
<foreignKey>
<name>payment_processor_id</name>
<table>civicrm_payment_processor</table>
<key>id</key>
- <add>4.7</add>
+ <add>4.6</add>
<onDelete>RESTRICT</onDelete>
</foreignKey>
<field>
<name>token</name>
- <type>varchar</type>
+ <type>varchar</type>
+ <title>Token</title>
<length>255</length>
<required>true</required>
<comment>Externally provided token string</comment>
- <add>4.7</add>
+ <add>4.6</add>
</field>
<field>
- <name>created_date</name>
+ <name>created_date</name>
+ <title>Created Date</title>
<type>timestamp</type>
<comment>Date created</comment>
- <add>4.7</add>
+ <add>4.6</add>
</field>
<field>
- <name>created_id</name>
+ <name>created_id</name>
+ <title>Created ID</title>
<type>int unsigned</type>
<comment>Contact ID of token creator</comment>
- <add>4.7</add>
+ <add>4.6</add>
</field>
<foreignKey>
<name>created_id</name>
<table>civicrm_contact</table>
<key>id</key>
- <add>4.7</add>
+ <add>4.6</add>
<onDelete>SET NULL</onDelete>
</foreignKey>
<field>
- <name>expiry_date</name>
+ <name>expiry_date</name>
+ <title>Expiry Date</title>
<type>datetime</type>
<comment>Date this token expires</comment>
- <add>4.7</add>
+ <add>4.6</add>
</field>
<field>
- <name>email</name>
+ <name>email</name>
+ <title>Email</title>
<length>255</length>
<type>varchar</type>
<comment>Email at the time of token creation. Useful for fraud forensics</comment>
- <add>4.7</add>
+ <add>4.6</add>
</field>
<field>
- <name>billing_first_name</name>
+ <name>billing_first_name</name>
+ <title>Billing First Name</title>
<type>varchar</type>
<length>255</length>
<comment>Billing first name at the time of token creation. Useful for fraud forensics</comment>
- <add>4.7</add>
+ <add>4.6</add>
</field>
<field>
<name>billing_middle_name</name>
+ <title>Billing Middle Name</title>
<type>varchar</type>
<length>255</length>
<comment>Billing middle name at the time of token creation. Useful for fraud forensics</comment>
- <add>4.7</add>
+ <add>4.6</add>
</field>
<field>
<name>billing_last_name</name>
+ <title>Billing Last Name</title>
<type>varchar</type>
<length>255</length>
<comment>Billing last name at the time of token creation. Useful for fraud forensics</comment>
- <add>4.7</add>
+ <add>4.6</add>
</field>
<field>
- <name>masked_account_number</name>
+ <name>masked_account_number</name>
+ <title>Masked Account Number</title>
<type>varchar</type>
<length>255</length>
<comment>Holds the part of the card number or account details that may be retained or displayed</comment>
- <add>4.7</add>
+ <add>4.6</add>
</field>
<field>
- <name>ip_address</name>
+ <name>ip_address</name>
+ <title>IP Address</title>
<type>varchar</type>
<length>255</length>
<comment>IP used when creating the token. Useful for fraud forensics</comment>
- <add>4.7</add>
+ <add>4.6</add>
</field>
</table>