public function createFlatDataTable() { $this->databaseSetup->start(); $tables = ['entity_flat_data' => ['columns' => ['entity_id' => [Table::TYPE_INTEGER, null, ['primary' => true, 'unsigned' => true]], 'scope_id' => [Table::TYPE_INTEGER, null, ['primary' => true, 'unsigned' => true]], 'firstname' => [Table::TYPE_TEXT, 255], 'dob' => [Table::TYPE_DATETIME], 'is_active' => [Table::TYPE_INTEGER]], 'indexes' => [['firstname'], ['dob'], ['is_active']], 'constraints' => [['entity_id', 'entity', 'entity_id'], ['scope_id', 'scope', 'scope_id']]]]; foreach ($this->attribute->getAll() as $item) { if (!isset($tables['entity_flat_data']['columns'][$item->code])) { $tables['entity_flat_data']['columns'][$item->code] = $this->attributeToColumn($item); } } $this->databaseSetup->createTables($tables); $this->databaseSetup->end(); }
protected function execute(InputInterface $input, OutputInterface $output) { $databasePrefix = $input->getOption('database-prefix'); $sizes = $input->getArgument('database-size'); if (empty($sizes)) { $output->writeln('<error>At least one database size needs to be specified</error>'); return 1; } foreach ($sizes as $size) { if (!is_numeric($size)) { $output->writeln(sprintf('<error>Size is a numeric value: %s</error>', $size)); return 1; } } foreach ($sizes as $size) { $dbName = sprintf('%s_%s', $databasePrefix, (int) $size); $this->setup->createSchema($dbName); $this->generator->generate($dbName, (int) $size * 1000); } return 0; }