*/ $installer = $this; /* @var $installer Mage_Customer_Model_Entity_Setup */ $installer->startSetup(); $installer->run(" -- DROP TABLE IF EXISTS `{$installer->getTable('customer_address_entity')}`; CREATE TABLE `{$installer->getTable('customer_address_entity')}` ( `entity_id` int(10) unsigned NOT NULL auto_increment, `entity_type_id` smallint(8) unsigned NOT NULL default '0', `attribute_set_id` smallint(5) unsigned NOT NULL default '0', `increment_id` varchar(50) NOT NULL default '', `parent_id` int(10) unsigned default NULL, `created_at` datetime NOT NULL default '0000-00-00 00:00:00', `updated_at` datetime NOT NULL default '0000-00-00 00:00:00', `is_active` tinyint(1) unsigned NOT NULL default '1', PRIMARY KEY (`entity_id`), KEY `FK_CUSTOMER_ADDRESS_CUSTOMER_ID` (`parent_id`), CONSTRAINT `FK_CUSTOMER_ADDRESS_CUSTOMER_ID` FOREIGN KEY (`parent_id`) REFERENCES `{$installer->getTable('customer_entity')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Customer Address Entities'; -- DROP TABLE IF EXISTS `{$installer->getTable('customer_address_entity_datetime')}`; CREATE TABLE `{$installer->getTable('customer_address_entity_datetime')}` ( `value_id` int(11) NOT NULL auto_increment, `entity_type_id` smallint(8) unsigned NOT NULL default '0', `attribute_id` smallint(5) unsigned NOT NULL default '0', `entity_id` int(10) unsigned NOT NULL default '0', `value` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`value_id`), KEY `FK_CUSTOMER_ADDRESS_DATETIME_ENTITY_TYPE` (`entity_type_id`), KEY `FK_CUSTOMER_ADDRESS_DATETIME_ATTRIBUTE` (`attribute_id`), KEY `FK_CUSTOMER_ADDRESS_DATETIME_ENTITY` (`entity_id`), CONSTRAINT `FK_CUSTOMER_ADDRESS_DATETIME_ATTRIBUTE` FOREIGN KEY (`attribute_id`) REFERENCES `{$installer->getTable('eav_attribute')}` (`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `FK_CUSTOMER_ADDRESS_DATETIME_ENTITY` FOREIGN KEY (`entity_id`) REFERENCES `{$installer->getTable('customer_address_entity')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `FK_CUSTOMER_ADDRESS_DATETIME_ENTITY_TYPE` FOREIGN KEY (`entity_type_id`) REFERENCES `{$installer->getTable('eav_entity_type')}` (`entity_type_id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- DROP TABLE IF EXISTS `{$installer->getTable('customer_address_entity_decimal')}`; CREATE TABLE `{$installer->getTable('customer_address_entity_decimal')}` ( `value_id` int(11) NOT NULL auto_increment, `entity_type_id` smallint(8) unsigned NOT NULL default '0', `attribute_id` smallint(5) unsigned NOT NULL default '0', `entity_id` int(10) unsigned NOT NULL default '0', `value` decimal(12,4) NOT NULL default '0.0000', PRIMARY KEY (`value_id`), KEY `FK_CUSTOMER_ADDRESS_DECIMAL_ENTITY_TYPE` (`entity_type_id`), KEY `FK_CUSTOMER_ADDRESS_DECIMAL_ATTRIBUTE` (`attribute_id`), KEY `FK_CUSTOMER_ADDRESS_DECIMAL_ENTITY` (`entity_id`), CONSTRAINT `FK_CUSTOMER_ADDRESS_DECIMAL_ATTRIBUTE` FOREIGN KEY (`attribute_id`) REFERENCES `{$installer->getTable('eav_attribute')}` (`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `FK_CUSTOMER_ADDRESS_DECIMAL_ENTITY` FOREIGN KEY (`entity_id`) REFERENCES `{$installer->getTable('customer_address_entity')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `FK_CUSTOMER_ADDRESS_DECIMAL_ENTITY_TYPE` FOREIGN KEY (`entity_type_id`) REFERENCES `{$installer->getTable('eav_entity_type')}` (`entity_type_id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- DROP TABLE IF EXISTS `{$installer->getTable('customer_address_entity_int')}`; CREATE TABLE `{$installer->getTable('customer_address_entity_int')}` ( `value_id` int(11) NOT NULL auto_increment, `entity_type_id` smallint(8) unsigned NOT NULL default '0', `attribute_id` smallint(5) unsigned NOT NULL default '0', `entity_id` int(10) unsigned NOT NULL default '0', `value` int(11) NOT NULL default '0', PRIMARY KEY (`value_id`), KEY `FK_CUSTOMER_ADDRESS_INT_ENTITY_TYPE` (`entity_type_id`), KEY `FK_CUSTOMER_ADDRESS_INT_ATTRIBUTE` (`attribute_id`), KEY `FK_CUSTOMER_ADDRESS_INT_ENTITY` (`entity_id`), CONSTRAINT `FK_CUSTOMER_ADDRESS_INT_ATTRIBUTE` FOREIGN KEY (`attribute_id`) REFERENCES `{$installer->getTable('eav_attribute')}` (`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `FK_CUSTOMER_ADDRESS_INT_ENTITY` FOREIGN KEY (`entity_id`) REFERENCES `{$installer->getTable('customer_address_entity')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `FK_CUSTOMER_ADDRESS_INT_ENTITY_TYPE` FOREIGN KEY (`entity_type_id`) REFERENCES `{$installer->getTable('eav_entity_type')}` (`entity_type_id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- DROP TABLE IF EXISTS `{$installer->getTable('customer_address_entity_text')}`; CREATE TABLE `{$installer->getTable('customer_address_entity_text')}` ( `value_id` int(11) NOT NULL auto_increment, `entity_type_id` smallint(8) unsigned NOT NULL default '0', `attribute_id` smallint(5) unsigned NOT NULL default '0', `entity_id` int(10) unsigned NOT NULL default '0', `value` text NOT NULL, PRIMARY KEY (`value_id`), KEY `FK_CUSTOMER_ADDRESS_TEXT_ENTITY_TYPE` (`entity_type_id`), KEY `FK_CUSTOMER_ADDRESS_TEXT_ATTRIBUTE` (`attribute_id`), KEY `FK_CUSTOMER_ADDRESS_TEXT_ENTITY` (`entity_id`), CONSTRAINT `FK_CUSTOMER_ADDRESS_TEXT_ATTRIBUTE` FOREIGN KEY (`attribute_id`) REFERENCES `{$installer->getTable('eav_attribute')}` (`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `FK_CUSTOMER_ADDRESS_TEXT_ENTITY` FOREIGN KEY (`entity_id`) REFERENCES `{$installer->getTable('customer_address_entity')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `FK_CUSTOMER_ADDRESS_TEXT_ENTITY_TYPE` FOREIGN KEY (`entity_type_id`) REFERENCES `{$installer->getTable('eav_entity_type')}` (`entity_type_id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- DROP TABLE IF EXISTS `{$installer->getTable('customer_address_entity_varchar')}`; CREATE TABLE `{$installer->getTable('customer_address_entity_varchar')}` ( `value_id` int(11) NOT NULL auto_increment, `entity_type_id` smallint(8) unsigned NOT NULL default '0', `attribute_id` smallint(5) unsigned NOT NULL default '0', `entity_id` int(10) unsigned NOT NULL default '0', `value` varchar(255) NOT NULL default '', PRIMARY KEY (`value_id`), KEY `FK_CUSTOMER_ADDRESS_VARCHAR_ENTITY_TYPE` (`entity_type_id`), KEY `FK_CUSTOMER_ADDRESS_VARCHAR_ATTRIBUTE` (`attribute_id`), KEY `FK_CUSTOMER_ADDRESS_VARCHAR_ENTITY` (`entity_id`), CONSTRAINT `FK_CUSTOMER_ADDRESS_VARCHAR_ATTRIBUTE` FOREIGN KEY (`attribute_id`) REFERENCES `{$installer->getTable('eav_attribute')}` (`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `FK_CUSTOMER_ADDRESS_VARCHAR_ENTITY` FOREIGN KEY (`entity_id`) REFERENCES `{$installer->getTable('customer_address_entity')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `FK_CUSTOMER_ADDRESS_VARCHAR_ENTITY_TYPE` FOREIGN KEY (`entity_type_id`) REFERENCES `{$installer->getTable('eav_entity_type')}` (`entity_type_id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- DROP TABLE IF EXISTS `{$installer->getTable('customer_entity')}`; CREATE TABLE `{$installer->getTable('customer_entity')}` ( `entity_id` int(10) unsigned NOT NULL auto_increment, `entity_type_id` smallint(8) unsigned NOT NULL default '0', `attribute_set_id` smallint(5) unsigned NOT NULL default '0', `website_id` smallint(5) unsigned default NULL, `email` varchar(255) NOT NULL default '', `group_id` smallint(3) unsigned NOT NULL default '0', `increment_id` varchar(50) NOT NULL default '', `store_id` smallint(5) unsigned default '0', `created_at` datetime NOT NULL default '0000-00-00 00:00:00', `updated_at` datetime NOT NULL default '0000-00-00 00:00:00', `is_active` tinyint(1) unsigned NOT NULL default '1', PRIMARY KEY (`entity_id`), KEY `FK_CUSTOMER_ENTITY_STORE` (`store_id`), KEY `IDX_ENTITY_TYPE` (`entity_type_id`), KEY `IDX_AUTH` (`email`,`website_id`), KEY `FK_CUSTOMER_WEBSITE` (`website_id`), CONSTRAINT `FK_CUSTOMER_ENTITY_STORE` FOREIGN KEY (`store_id`) REFERENCES `{$installer->getTable('core_store')}` (`store_id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `FK_CUSTOMER_WEBSITE` FOREIGN KEY (`website_id`) REFERENCES `{$installer->getTable('core_website')}` (`website_id`) ON DELETE SET NULL ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Customer Entityies'; -- DROP TABLE IF EXISTS `{$installer->getTable('customer_entity_datetime')}`; CREATE TABLE `{$installer->getTable('customer_entity_datetime')}` ( `value_id` int(11) NOT NULL auto_increment, `entity_type_id` smallint(8) unsigned NOT NULL default '0', `attribute_id` smallint(5) unsigned NOT NULL default '0', `entity_id` int(10) unsigned NOT NULL default '0', `value` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`value_id`), KEY `FK_CUSTOMER_DATETIME_ENTITY_TYPE` (`entity_type_id`), KEY `FK_CUSTOMER_DATETIME_ATTRIBUTE` (`attribute_id`), KEY `FK_CUSTOMER_DATETIME_ENTITY` (`entity_id`), CONSTRAINT `FK_CUSTOMER_DATETIME_ATTRIBUTE` FOREIGN KEY (`attribute_id`) REFERENCES `{$installer->getTable('eav_attribute')}` (`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `FK_CUSTOMER_DATETIME_ENTITY` FOREIGN KEY (`entity_id`) REFERENCES `{$installer->getTable('customer_entity')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `FK_CUSTOMER_DATETIME_ENTITY_TYPE` FOREIGN KEY (`entity_type_id`) REFERENCES `{$installer->getTable('eav_entity_type')}` (`entity_type_id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- DROP TABLE IF EXISTS `{$installer->getTable('customer_entity_decimal')}`; CREATE TABLE `{$installer->getTable('customer_entity_decimal')}` ( `value_id` int(11) NOT NULL auto_increment, `entity_type_id` smallint(8) unsigned NOT NULL default '0', `attribute_id` smallint(5) unsigned NOT NULL default '0', `entity_id` int(10) unsigned NOT NULL default '0', `value` decimal(12,4) NOT NULL default '0.0000', PRIMARY KEY (`value_id`), KEY `FK_CUSTOMER_DECIMAL_ENTITY_TYPE` (`entity_type_id`), KEY `FK_CUSTOMER_DECIMAL_ATTRIBUTE` (`attribute_id`), KEY `FK_CUSTOMER_DECIMAL_ENTITY` (`entity_id`), CONSTRAINT `FK_CUSTOMER_DECIMAL_ATTRIBUTE` FOREIGN KEY (`attribute_id`) REFERENCES `{$installer->getTable('eav_attribute')}` (`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `FK_CUSTOMER_DECIMAL_ENTITY` FOREIGN KEY (`entity_id`) REFERENCES `{$installer->getTable('customer_entity')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `FK_CUSTOMER_DECIMAL_ENTITY_TYPE` FOREIGN KEY (`entity_type_id`) REFERENCES `{$installer->getTable('eav_entity_type')}` (`entity_type_id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- DROP TABLE IF EXISTS `{$installer->getTable('customer_entity_int')}`; CREATE TABLE `{$installer->getTable('customer_entity_int')}` ( `value_id` int(11) NOT NULL auto_increment, `entity_type_id` smallint(8) unsigned NOT NULL default '0', `attribute_id` smallint(5) unsigned NOT NULL default '0', `entity_id` int(10) unsigned NOT NULL default '0', `value` int(11) NOT NULL default '0', PRIMARY KEY (`value_id`), KEY `FK_CUSTOMER_INT_ENTITY_TYPE` (`entity_type_id`), KEY `FK_CUSTOMER_INT_ATTRIBUTE` (`attribute_id`), KEY `FK_CUSTOMER_INT_ENTITY` (`entity_id`), CONSTRAINT `FK_CUSTOMER_INT_ATTRIBUTE` FOREIGN KEY (`attribute_id`) REFERENCES `{$installer->getTable('eav_attribute')}` (`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `FK_CUSTOMER_INT_ENTITY` FOREIGN KEY (`entity_id`) REFERENCES `{$installer->getTable('customer_entity')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `FK_CUSTOMER_INT_ENTITY_TYPE` FOREIGN KEY (`entity_type_id`) REFERENCES `{$installer->getTable('eav_entity_type')}` (`entity_type_id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- DROP TABLE IF EXISTS `{$installer->getTable('customer_entity_text')}`; CREATE TABLE `{$installer->getTable('customer_entity_text')}` ( `value_id` int(11) NOT NULL auto_increment, `entity_type_id` smallint(8) unsigned NOT NULL default '0', `attribute_id` smallint(5) unsigned NOT NULL default '0', `entity_id` int(10) unsigned NOT NULL default '0', `value` text NOT NULL, PRIMARY KEY (`value_id`), KEY `FK_CUSTOMER_TEXT_ENTITY_TYPE` (`entity_type_id`), KEY `FK_CUSTOMER_TEXT_ATTRIBUTE` (`attribute_id`), KEY `FK_CUSTOMER_TEXT_ENTITY` (`entity_id`), CONSTRAINT `FK_CUSTOMER_TEXT_ATTRIBUTE` FOREIGN KEY (`attribute_id`) REFERENCES `{$installer->getTable('eav_attribute')}` (`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `FK_CUSTOMER_TEXT_ENTITY` FOREIGN KEY (`entity_id`) REFERENCES `{$installer->getTable('customer_entity')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `FK_CUSTOMER_TEXT_ENTITY_TYPE` FOREIGN KEY (`entity_type_id`) REFERENCES `{$installer->getTable('eav_entity_type')}` (`entity_type_id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- DROP TABLE IF EXISTS `{$installer->getTable('customer_entity_varchar')}`; CREATE TABLE `{$installer->getTable('customer_entity_varchar')}` ( `value_id` int(11) NOT NULL auto_increment, `entity_type_id` smallint(8) unsigned NOT NULL default '0', `attribute_id` smallint(5) unsigned NOT NULL default '0', `entity_id` int(10) unsigned NOT NULL default '0', `value` varchar(255) NOT NULL default '', PRIMARY KEY (`value_id`), KEY `FK_CUSTOMER_VARCHAR_ENTITY_TYPE` (`entity_type_id`), KEY `FK_CUSTOMER_VARCHAR_ATTRIBUTE` (`attribute_id`), KEY `FK_CUSTOMER_VARCHAR_ENTITY` (`entity_id`), CONSTRAINT `FK_CUSTOMER_VARCHAR_ATTRIBUTE` FOREIGN KEY (`attribute_id`) REFERENCES `{$installer->getTable('eav_attribute')}` (`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `FK_CUSTOMER_VARCHAR_ENTITY` FOREIGN KEY (`entity_id`) REFERENCES `{$installer->getTable('customer_entity')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `FK_CUSTOMER_VARCHAR_ENTITY_TYPE` FOREIGN KEY (`entity_type_id`) REFERENCES `{$installer->getTable('eav_entity_type')}` (`entity_type_id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- DROP TABLE IF EXISTS `{$installer->getTable('customer_group')}`; CREATE TABLE `{$installer->getTable('customer_group')}` ( `customer_group_id` smallint(3) unsigned NOT NULL auto_increment, `customer_group_code` varchar(32) NOT NULL default '', `tax_class_id` int(10) unsigned NOT NULL default '0', PRIMARY KEY (`customer_group_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Customer groups'; INSERT INTO `{$installer->getTable('customer_group')}` VALUES(0, 'NOT LOGGED IN', 3), (1, 'General', 3), (2, 'Wholesale', 3), (3, 'Retailer', 3); "); $installer->endSetup(); $installer->installEntities();