예제 #1
0
<?php

/**
 * Install data tables
 *
 * @category    Snap
 * @package     Snap_Card
 * @author      alex
 */
/** @var $installer Mage_Sales_Model_Resource_Setup */
$installer = new Mage_Sales_Model_Resource_Setup();
$installer->startSetup();
$installer->run("CREATE TABLE IF NOT EXISTS `{$installer->getTable('snap_card/entity')}`(\n    `entity_id` INT(6) UNSIGNED NOT NULL AUTO_INCREMENT,\n    `code` VARCHAR(32) NOT NULL,\n    `pin` INT(8) DEFAULT NULL,\n    `status` VARCHAR(64) NOT NULL DEFAULT 'Activated',\n    `total` DECIMAL(12,4) NOT NULL DEFAULT '0.0000',\n    `balance` DECIMAL(12,4) NOT NULL DEFAULT '0.0000',\n    `customer_id` INT(6) DEFAULT NULL,\n    `created_at` DATETIME DEFAULT '0000-00-00 00:00:00',\n    PRIMARY KEY (`entity_id`),\n    UNIQUE KEY `IDX_CODE` (`code`)\n) ENGINE=INNODB DEFAULT CHARSET=utf8;");
$installer->run("CREATE TABLE IF NOT EXISTS `{$installer->getTable('snap_card/usage')}`(\n  `entity_id` int(6) unsigned NOT NULL AUTO_INCREMENT,\n  `card_id` int(6) NOT NULL,\n  `website_id` smallint(5) unsigned NOT NULL,\n  `amount` decimal(12,4) NOT NULL DEFAULT '0.0000',\n  `customer_id` int(6) DEFAULT NULL,\n  `order_id` int(6) DEFAULT NULL,\n  PRIMARY KEY (`entity_id`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8");
$installer->endSetup();