From a889137fd4ae4955bd13be0d62da78e89343e64c Mon Sep 17 00:00:00 2001
From: Matthew Wire <mjw@mjwconsult.co.uk>
Date: Fri, 21 Aug 2020 18:47:38 +0100
Subject: [PATCH] Fix create table

---
 sql/auto_uninstall.sql        |  4 ++--
 sql/customers_install.sql     | 12 ++++++------
 sql/paymentintent_install.sql | 32 +++++++++++++++-----------------
 3 files changed, 23 insertions(+), 25 deletions(-)

diff --git a/sql/auto_uninstall.sql b/sql/auto_uninstall.sql
index 80360acf..5327214c 100644
--- a/sql/auto_uninstall.sql
+++ b/sql/auto_uninstall.sql
@@ -11,7 +11,7 @@
 --
 -- /*******************************************************
 -- *
--- * Clean up the exisiting tables
+-- * Clean up the existing tables
 -- *
 -- *******************************************************/
 
@@ -19,4 +19,4 @@ SET FOREIGN_KEY_CHECKS=0;
 
 DROP TABLE IF EXISTS `civicrm_stripe_paymentintent`;
 
-SET FOREIGN_KEY_CHECKS=1;
\ No newline at end of file
+SET FOREIGN_KEY_CHECKS=1;
diff --git a/sql/customers_install.sql b/sql/customers_install.sql
index b5043468..5cae99d4 100644
--- a/sql/customers_install.sql
+++ b/sql/customers_install.sql
@@ -1,8 +1,8 @@
 CREATE TABLE IF NOT EXISTS `civicrm_stripe_customers` (
-                                                          `id` varchar(255) DEFAULT NULL,
-                                                          `contact_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'FK ID from civicrm_contact',
-                                                          `processor_id` int(10) DEFAULT NULL COMMENT 'ID from civicrm_payment_processor',
-                                                          UNIQUE KEY `id` (`id`),
-                                                          CONSTRAINT `FK_civicrm_stripe_customers_contact_id` FOREIGN KEY (`contact_id`)
-                                                              REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE
+  `id` varchar(255) DEFAULT NULL,
+  `contact_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'FK ID from civicrm_contact',
+  `processor_id` int(10) DEFAULT NULL COMMENT 'ID from civicrm_payment_processor',
+  UNIQUE KEY `id` (`id`),
+  CONSTRAINT `FK_civicrm_stripe_customers_contact_id` FOREIGN KEY (`contact_id`)
+  REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE
 ) ENGINE=InnoDB;
diff --git a/sql/paymentintent_install.sql b/sql/paymentintent_install.sql
index 0ff2dac6..7adf9741 100644
--- a/sql/paymentintent_install.sql
+++ b/sql/paymentintent_install.sql
@@ -1,19 +1,17 @@
 CREATE TABLE IF NOT EXISTS `civicrm_stripe_paymentintent` (
-    `id` int unsigned NOT NULL AUTO_INCREMENT  COMMENT 'Unique ID',
-    `paymentintent_id` varchar(255)    COMMENT 'The PaymentIntent ID',
-    `contribution_id` int unsigned    COMMENT 'FK ID from civicrm_contribution',
-    `payment_processor_id` int unsigned    COMMENT 'Foreign key to civicrm_payment_processor.id',
-    `description` varchar(255) NULL   COMMENT 'Description of this paymentIntent',
-    `status` varchar(25) NULL   COMMENT 'The status of the paymentIntent',
-    `identifier` varchar(255) NULL   COMMENT 'An identifier that we can use in CiviCRM to find the paymentIntent if we do not have the ID (eg. session key)',
-    `contact_id` int unsigned    COMMENT 'FK to Contact',
-    `created_date` timestamp   DEFAULT CURRENT_TIMESTAMP COMMENT 'When was paymentIntent created',
-    `flags` varchar(100) NULL   COMMENT 'Flags associated with this PaymentIntent (NC=no contributionID when doPayment called)',
-    `referrer` varchar(255) NULL   COMMENT 'HTTP referrer of this paymentIntent'
-    PRIMARY KEY (`id`),
-    UNIQUE INDEX `UI_paymentintent_id` (
-        paymentintent_id
-    ),
-    CONSTRAINT FK_civicrm_stripe_paymentintent_payment_processor_id FOREIGN KEY (`payment_processor_id`) REFERENCES `civicrm_payment_processor`(`id`) ON DELETE SET NULL,
-    CONSTRAINT FK_civicrm_stripe_paymentintent_contact_id FOREIGN KEY (`contact_id`) REFERENCES `civicrm_contact`(`id`) ON DELETE CASCADE
+  `id` int unsigned NOT NULL AUTO_INCREMENT  COMMENT 'Unique ID',
+  `paymentintent_id` varchar(255)    COMMENT 'The PaymentIntent ID',
+  `contribution_id` int unsigned    COMMENT 'FK ID from civicrm_contribution',
+  `payment_processor_id` int unsigned    COMMENT 'Foreign key to civicrm_payment_processor.id',
+  `description` varchar(255) NULL   COMMENT 'Description of this paymentIntent',
+  `status` varchar(25) NULL   COMMENT 'The status of the paymentIntent',
+  `identifier` varchar(255) NULL   COMMENT 'An identifier that we can use in CiviCRM to find the paymentIntent if we do not have the ID (eg. session key)',
+  `contact_id` int unsigned    COMMENT 'FK to Contact',
+  `created_date` timestamp   DEFAULT CURRENT_TIMESTAMP COMMENT 'When was paymentIntent created',
+  `flags` varchar(100) NULL   COMMENT 'Flags associated with this PaymentIntent (NC=no contributionID when doPayment called)',
+  `referrer` varchar(255) NULL   COMMENT 'HTTP referrer of this paymentIntent',
+  PRIMARY KEY (`id`),
+  UNIQUE INDEX `UI_paymentintent_id` (paymentintent_id),
+  CONSTRAINT FK_civicrm_stripe_paymentintent_payment_processor_id FOREIGN KEY (`payment_processor_id`) REFERENCES `civicrm_payment_processor`(`id`) ON DELETE SET NULL,
+  CONSTRAINT FK_civicrm_stripe_paymentintent_contact_id FOREIGN KEY (`contact_id`) REFERENCES `civicrm_contact`(`id`) ON DELETE CASCADE
 ) ENGINE=InnoDB;
-- 
GitLab