/** * Execute Command To Run Migration. * * @return mixed|void */ public function process() { // Migrate init - to create migration table $type = $this->argument('type'); $migration = Migrator::instance($this); $migration->getLatestMigration()->setMigrationClassName(); if ($type == '' || $type == 'up') { $migration->updateMigration(); } else { $migration->updateMigration('down'); } $this->info('Migration Completed Successfully!'); }
protected function execute(InputInterface $input, OutputInterface $output) { // Migrate init - to create migration table $type = $input->getArgument('type'); $migration = $migrationName = null; $migration = Migrator::instance(new Inflector(), $this); $migration->getLatestMigration($this->migrationDir)->setMigrationClassName(); if ($type == '') { $migration->updateMigration(); } else { $migration->updateMigration('down'); } $output->writeln("Migration completed Successfully!"); }
protected function execute(InputInterface $input, OutputInterface $output) { $this->input = $input->getArgument('name'); $this->appDir = BASE_PATH . DS . APP_PATH; $migrateTemplateDir = dirname(dirname(__FILE__)) . DS . 'src' . DS . 'apps' . DS . 'database' . DS; $migrateInstance = null; $migrateInstance = Migrator::instance(new Inflector(), $this); $this->table->makeMigration('migrations'); $migrateInstance->setTemplateDir($migrateTemplateDir); $migrateInstance->replaceTemplateByInput(); $status = $migrateInstance->generate(new \DateTime('now', new \DateTimeZone('Europe/London'))); if ($status) { $output->writeln("Your migration class generated in {$status}"); } }
protected function execute(InputInterface $input, OutputInterface $output) { $this->input = $input->getArgument('name'); $this->appDir = CYGNITE_BASE . DS . APPPATH; $migrateTemplateDir = dirname(dirname(__FILE__)) . DS . 'src' . DS . 'apps' . DS . 'database' . DS; $migrateInstance = null; $migrateInstance = Migrator::instance($this); $this->getSchema()->makeMigration('migrations'); // We will generate migration class only if class name provided in command if (!is_null($this->input)) { $migrateInstance->setTemplateDir($migrateTemplateDir); $migrateInstance->replaceTemplateByInput(); $status = $migrateInstance->generate(new \DateTime('now', new \DateTimeZone('Europe/London'))); if ($status) { $output->writeln("Your migration class generated in {$status}"); } } }
/** * Execute Command To Initialize Migration Class. * * @return int|null|void */ public function process() { $this->argumentName = $this->argument('name'); $this->appDir = CYGNITE_BASE . DS . APPPATH; $migrateTemplateDir = dirname(dirname(__FILE__)) . DS . 'src' . DS . 'Apps' . DS . 'Database' . DS; $migrateInstance = null; $migrateInstance = Migrator::instance($this); $this->table()->makeMigration('migrations'); // We will generate migration class only if class name provided in command if (!is_null($this->argumentName)) { $migrateInstance->setTemplateDir($migrateTemplateDir); $migrateInstance->replaceTemplateByInput(); $file = $migrateInstance->generate(new \DateTime('now', new \DateTimeZone(SET_TIME_ZONE))); if ($file) { $file = APP_NS . DS . 'Resources' . DS . 'Database' . DS . 'Migrations' . DS . $file; $this->info('Your migration class generated in ' . $file); } $this->info('Cool!! You are ready to use migration!'); } }