startSetup(); $installer->run(" CREATE TABLE `{$installer->getTable('paypal_settlement_report')}` ( `report_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `report_date` date NOT NULL, `account_id` varchar(64) NOT NULL, `filename` varchar(24) NOT NULL, `last_modified` datetime NOT NULL, PRIMARY KEY (`report_id`), UNIQUE KEY `UNQ_REPORT_DATE_ACCOUNT` (`report_date`,`account_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `{$installer->getTable('paypal_settlement_report_row')}` ( `row_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `report_id` int(10) unsigned NOT NULL, `transaction_id` varchar(19) NOT NULL, `invoice_id` varchar(127) DEFAULT NULL, `paypal_reference_id` varchar(19) NOT NULL, `paypal_reference_id_type` enum('ODR','TXN','SUB','PAP','') NOT NULL, `transaction_event_code` char(5) NOT NULL DEFAULT '', `transaction_initiation_date` datetime DEFAULT NULL, `transaction_completion_date` datetime DEFAULT NULL, `transaction_debit_or_credit` enum('CR','DR') NOT NULL DEFAULT 'CR', `gross_transaction_amount` decimal(20,6) NOT NULL DEFAULT '0.000000', `gross_transaction_currency` char(3) NOT NULL DEFAULT '', `fee_debit_or_credit` enum('CR','DR') NOT NULL, `fee_amount` decimal(20,6) NOT NULL DEFAULT '0.000000', `fee_currency` char(3) NOT NULL, `custom_field` varchar(255) DEFAULT NULL, `consumer_id` varchar(127) NOT NULL DEFAULT '', PRIMARY KEY (`row_id`), KEY `IDX_REPORT_ID` (`report_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ALTER TABLE `{$installer->getTable('paypal_settlement_report_row')}` ADD CONSTRAINT `FK_PAYPAL_SETTLEMENT_ROW_REPORT` FOREIGN KEY (`report_id`) REFERENCES `{$installer->getTable('paypal_settlement_report')}` (`report_id`) ON DELETE CASCADE ON UPDATE CASCADE; "); $installer->endSetup();