<?php /** * @package magento * @subpackage AncPricepercustomer * * @author netz.coop code[at]netz.coop * * @license http://www.gnu.org/licenses/gpl-3.0.de.html GNU GENERAL PUBLIC LICENSE VERSION 3 * @copyright (C) 2015 netz.coop eG * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ $installer = $this; $installer->startSetup(); $tableName = $installer->getTable('anc_pricespercustomer/entity'); if ($installer->getConnection()->isTableExists($tableName) != true) { $table = $installer->getConnection()->newTable($tableName) ->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true,), 'Entity Id') ->addColumn('customer_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array('unsigned' => true, 'nullable' => false, 'default' => '0',), 'Customer Id') ->addColumn('product_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array('unsigned' => true, 'nullable' => false, 'default' => '0',), 'Product Id') ->addColumn('price_adjustment', Varien_Db_Ddl_Table::TYPE_DECIMAL, '12,4', array('default' => '0.0',), 'Price Adjustment') ->addColumn('price_adjustment_type', Varien_Db_Ddl_Table::TYPE_VARCHAR, null, array(), 'Price Adjustment Type') ->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array('nullable' => false,), 'Created At') ->addIndex($installer->getIdxName('anc_pricespercustomer/entity', array('customer_id')), array('customer_id')) ->addIndex($installer->getIdxName('anc_pricespercustomer/entity', array('product_id')), array('product_id')) ->addForeignKey($installer->getFkName('anc_pricespercustomer/entity', 'customer_id', 'customer/entity', 'entity_id'), 'customer_id', $installer->getTable('customer/entity'), 'entity_id', Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE) ->addForeignKey($installer->getFkName('anc_pricespercustomer/entity', 'product_id', 'catalog/product', 'entity_id'), 'product_id', $installer->getTable('catalog/product'), 'entity_id', Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE) ; $installer->getConnection()->createTable($table); } $installer->endSetup();