CREATE TABLE `ma_AuthorizeNetAccount` (
    `id` int(10) UNSIGNED NOT NULL,
    `title` varchar(255) NOT NULL DEFAULT '',
    `apiLoginId` varchar(255) NOT NULL DEFAULT '',
    `transactionKey` varchar(255) NOT NULL DEFAULT '',
    `sorter` int(11) NOT NULL DEFAULT '0',
    `added` datetime NOT NULL,
    `changed` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

ALTER TABLE `ma_AuthorizeNetAccount`
    ADD PRIMARY KEY (`id`);

ALTER TABLE `ma_AuthorizeNetAccount`
    MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

ALTER TABLE `ma_Tribe` ADD `authorizeNetAccountId` INT UNSIGNED NULL DEFAULT NULL AFTER `merchantId`, ADD INDEX (`authorizeNetAccountId`);

ALTER TABLE `ma_Tribe` ADD FOREIGN KEY (`authorizeNetAccountId`) REFERENCES `ma_AuthorizeNetAccount`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
