install-0.1.0.php 5.19 KB
<?php
/** 
 * @copyright (c) 2014, netz.coop eG
 */
/**
 * @var Mage_Sales_Model_Mysql4_Setup $installer
 */
$installer = $this;
$installer->startSetup();

$tableName = $installer->getTable('anc_album/ncalbum');
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('url_rewrite',	Varien_Db_Ddl_Table::TYPE_VARCHAR,	null, array(), 'url_rewrite')
		->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('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_at',	Varien_Db_Ddl_Table::TYPE_TIMESTAMP,null, array(), 'When deleted')
		->addColumn('deleted',		Varien_Db_Ddl_Table::TYPE_TINYINT,	null, array('default' => '0'), 'Deleted')

		->addColumn('original_id',	Varien_Db_Ddl_Table::TYPE_INTEGER,	null, array('unsigned' => true,'nullable' => false,'default' => '0',),'wenn album dupliziert wird, würde hier die original album id angezeigt werden')
		->addColumn('ncright_id',	Varien_Db_Ddl_Table::TYPE_INTEGER,	null, array('unsigned' => true,'nullable' => false,'default' => '0',),'Who Created frontend')
		->addColumn('isplaylist',	Varien_Db_Ddl_Table::TYPE_BOOLEAN,	null, array('default' => '1'), 'is a playlist checkbox')
		->addColumn('iscategory',	Varien_Db_Ddl_Table::TYPE_BOOLEAN,	null, array('default' => '1'), 'is a category checkbox')
	
		->addIndex($installer->getIdxName('anc_album/ncalbum', array('customer_id')),array('customer_id'))
		->addIndex($installer->getIdxName('anc_album/ncalbum', array('admin_user_id')),array('admin_user_id'))			
		->addIndex($installer->getIdxName('anc_album/ncalbum', array('original_id')),array('original_id'))			
			
		// http://docs.magentocommerce.com/Varien/Varien_Db/Varien_Db_Ddl_Table.html#addForeignKey
//		->addForeignKey( 
//			$installer->getFkName( 'anc_album/ncalbum','customer_id','customer/entity','entity_id'),	'customer_id', 
//			$installer->getTable('customer/entity'),	'entity_id', 
//			Varien_Db_Ddl_Table::ACTION_NO_ACTION,			Varien_Db_Ddl_Table::ACTION_NO_ACTION
//		)
//		->addForeignKey( 
//			$installer->getFkName( 'anc_album/ncalbum','admin_user_id','admin/user','user_id'),			'admin_user_id', 
//			$installer->getTable('admin/user'),			'user_id', 
//			Varien_Db_Ddl_Table::ACTION_NO_ACTION,			Varien_Db_Ddl_Table::ACTION_NO_ACTION
//		)			
//		->addForeignKey( 
//			$installer->getFkName( 'anc_album/ncalbum','original_id','anc_album/ncalbum','entity_id'),	'original_id', 
//			$installer->getTable('anc_album/ncalbum'),	'entity_id', 
//			Varien_Db_Ddl_Table::ACTION_NO_ACTION,			Varien_Db_Ddl_Table::ACTION_NO_ACTION
//		)				
	;
	
	
    $installer->getConnection()->createTable($table);	
}

















/**
 * @deprecated !!! @since 20140812 ist jetzt in AncPlaylist .... 
 */
//$tableName = $installer->getTable('anc_album/ncsite');
//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('customer_id',	Varien_Db_Ddl_Table::TYPE_INTEGER,null,array('unsigned' => true,'nullable' => false,'default' => '0',),'Customer ID')			
//		->addColumn('ncalbum_id',	Varien_Db_Ddl_Table::TYPE_INTEGER,null,array('unsigned' => true,'nullable' => false,'default' => '0',),'ncalbum id')			
//		->addColumn('order_id',		Varien_Db_Ddl_Table::TYPE_INTEGER,null,array('unsigned' => true,'nullable' => false,'default' => '0',),'Order Id')			
//		->addColumn('quote_item_id',Varien_Db_Ddl_Table::TYPE_INTEGER,null,array('unsigned' => true,'nullable' => false,'default' => '0',),'Quote Item Id')
//			
//		->addColumn('ordertime',	Varien_Db_Ddl_Table::TYPE_TIMESTAMP,null,array(),'Bestellzeitpunkt')
//		->addColumn('product_name',	Varien_Db_Ddl_Table::TYPE_VARCHAR,null,array(),'Produktname')						
//		->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_at',	Varien_Db_Ddl_Table::TYPE_TIMESTAMP,null, array(), 'When deleted')
//		->addColumn('deleted',		Varien_Db_Ddl_Table::TYPE_TINYINT,null,array('default' => '0'),'Deleted')	
//		->addColumn('track_num',		Varien_Db_Ddl_Table::TYPE_INTEGER,null,array('unsigned' => true,'nullable' => false,'default' => '0',),'Aufrufe')
//			
//	;
//    $installer->getConnection()->createTable($table);	
//}
//
//$installer->endSetup();









?>