install-0.1.0.php 7.01 KB
<?php
/**
 * @package  anc_lib 
 * @category magento
 * @mailto	code [at] netz.coop
 * @author	netz.coop eG* 
 * @copyright (c) 2014, 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/>.
 * 
 */ 
/**
 * @var Mage_Sales_Model_Mysql4_Setup $installer
 */
$installer = $this;
$installer->startSetup();

$tableName = $installer->getTable('anc_lib/timetable');
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,), 'Id')
            ->addColumn('name', Varien_Db_Ddl_Table::TYPE_VARCHAR, null, array(), 'Name')
            ->addColumn('comment', Varien_Db_Ddl_Table::TYPE_VARCHAR, null, array(), 'comment')
            ->addColumn('admin_user_id',	Varien_Db_Ddl_Table::TYPE_INTEGER,null,array('unsigned' => true,'nullable' => false,'default' => '0',),'Who Created backend')			
            ->addColumn('customer_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array('unsigned' => true, 'nullable' => false, 'default' => '0',), 'Who Created frontend')
            ->addColumn('start',       Varien_Db_Ddl_Table::TYPE_TIMESTAMP,null,array(),'Start Date as Timestamp')
            ->addColumn('stop',       Varien_Db_Ddl_Table::TYPE_TIMESTAMP,null,array(),'End Date as Timestamp')
            ->addColumn('starthour',       Varien_Db_Ddl_Table::TYPE_INTEGER,null,array('default' => '0'),'Daily start Hour')
            ->addColumn('stophour',       Varien_Db_Ddl_Table::TYPE_INTEGER,null,array('default' => '23'),'Daily stop Hour')
            ->addColumn('startmin',       Varien_Db_Ddl_Table::TYPE_INTEGER,null,array('default' => '0'),'Daily start Min')
            ->addColumn('stopmin',       Varien_Db_Ddl_Table::TYPE_INTEGER,null,array('default' => '59'),'Daily stop Min')
            ->addColumn('monday', Varien_Db_Ddl_Table::TYPE_BOOLEAN, null, array('default' => '1'), 'Runs Mondays')
            ->addColumn('tuesday', Varien_Db_Ddl_Table::TYPE_BOOLEAN, null, array('default' => '1'), 'Runs Tuesday')
            ->addColumn('wednesday', Varien_Db_Ddl_Table::TYPE_BOOLEAN, null, array('default' => '1'), 'Runs Wednesday')
            ->addColumn('thursday', Varien_Db_Ddl_Table::TYPE_BOOLEAN, null, array('default' => '1'), 'Runs Thursday')
            ->addColumn('friday', Varien_Db_Ddl_Table::TYPE_BOOLEAN, null, array('default' => '1'), 'Runs Friday')
            ->addColumn('saturday', Varien_Db_Ddl_Table::TYPE_BOOLEAN, null, array('default' => '1'), 'Runs Saturday')
            ->addColumn('sunday', Varien_Db_Ddl_Table::TYPE_BOOLEAN, null, array('default' => '1'), 'Runs Sunday')
            ->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(), 'When beginn')
            ->addColumn('updated_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(), 'When updated')
            ->addColumn('deleted', Varien_Db_Ddl_Table::TYPE_TINYINT, null, array('default' => '0'), 'Deleted')
    ;
    $installer->getConnection()->createTable($table);
}


$tableName = $installer->getTable('anc_lib/ncrights');
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,), 'Id')
			->addColumn('name', Varien_Db_Ddl_Table::TYPE_VARCHAR, null, array(), 'Name')
            ->addColumn('comment',		Varien_Db_Ddl_Table::TYPE_VARCHAR,	null, array(), 'comment')
			->addColumn('admin_user_id',	Varien_Db_Ddl_Table::TYPE_INTEGER,null,array('unsigned' => true,'nullable' => false,'default' => '0',),'Who Created backend')			
            ->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(), 'When beginn')
            ->addColumn('updated_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(), 'When updated')
            ->addColumn('deleted', Varien_Db_Ddl_Table::TYPE_TINYINT, null, array('default' => '0'), 'Deleted')
    ;
    $installer->getConnection()->createTable($table);
}


$tableName = $installer->getTable('anc_lib/ncrightscustomers');
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,), 'Id')
			->addColumn('rights_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array('unsigned' => true,), 'Rights Id')
			->addColumn('customer_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array('unsigned' => true,), 'Customer Id')
            ->addColumn('admin_user_id',	Varien_Db_Ddl_Table::TYPE_INTEGER,null,array('unsigned' => true,'nullable' => false,'default' => '0',),'Who Created backend')			
            ->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(), 'When beginn')
            ->addColumn('updated_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(), 'When updated')
            ->addColumn('deleted', Varien_Db_Ddl_Table::TYPE_TINYINT, null, array('default' => '0'), 'Deleted')
    ;
    $installer->getConnection()->createTable($table);
}


$tableName = $installer->getTable('anc_lib/ncrightsgroups');
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,), 'Id')
			->addColumn('rights_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array('unsigned' => true,), 'Rights Id')
			->addColumn('customer_group_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array('unsigned' => true,), 'Group Id')
            ->addColumn('admin_user_id',	Varien_Db_Ddl_Table::TYPE_INTEGER,null,array('unsigned' => true,'nullable' => false,'default' => '0',),'Who Created backend')			
            ->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(), 'When beginn')
            ->addColumn('updated_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(), 'When updated')
            ->addColumn('deleted', Varien_Db_Ddl_Table::TYPE_TINYINT, null, array('default' => '0'), 'Deleted')
    ;
    $installer->getConnection()->createTable($table);
}



$installer->endSetup();

//
//
//
?>