/** * Execute the console command. * * @return void */ public function fire() { if ($this->option('sql')) { $this->info('Outputting create query:'); $sql = $this->tool->getCreateSchemaSql($this->metadata->getAllMetadata()); $this->info(implode(';' . PHP_EOL, $sql)); } else { $this->info('Creating database schema...'); $this->tool->createSchema($this->metadata->getAllMetadata()); $this->info('Schema has been created!'); } }
/** * Execute the console command. * * @return void */ public function fire() { $sql = $this->tool->getDropSchemaSQL($this->metadata->getAllMetadata()); if (empty($sql)) { $this->info('Current models do not exist in schema.'); return; } if ($this->option('sql')) { $this->info('Outputting drop query:'); $this->info(implode(';' . PHP_EOL, $sql)); } else { $this->info('Dropping database schema....'); $this->tool->dropSchema($this->metadata->getAllMetadata()); $this->info('Schema has been dropped!'); } }
public function fire() { if ($this->option('sql')) { $this->info('Outputting create query:' . PHP_EOL); $sql = $this->tool->getCreateSchemaSql($this->metadata->getAllMetadata()); $this->info(implode(';' . PHP_EOL, $sql) . ';'); } else { if ($this->option('commit')) { $this->info('Creating database schema...'); $this->tool->createSchema($this->metadata->getAllMetadata()); $this->info('Schema has been created!'); } else { $this->comment("Warning: this command can cause data loss. Run with --sql or --commit."); } } }
/** * Execute the console command. * * @return void */ public function fire() { $this->info('Checking if database needs updating....'); $clean = $this->option('clean'); $sql = $this->tool->getUpdateSchemaSql($this->metadata->getAllMetadata(), !$clean); if (empty($sql)) { $this->info('No updates found.'); return; } if ($this->option('sql')) { $this->info('Outputting update query:'); $this->info(implode(';' . PHP_EOL, $sql)); } else { $this->info('Updating database schema....'); $this->tool->updateSchema($this->metadata->getAllMetadata(), !$clean); $this->info('Schema has been updated!'); } }
public function fire() { $sql = $this->tool->getDropSchemaSQL($this->metadata->getAllMetadata()); if (empty($sql)) { $this->error('Current models do not exist in schema.'); return; } if ($this->option('sql')) { $this->info('Outputting drop query:' . PHP_EOL); $this->line(implode(';' . PHP_EOL, $sql) . ';'); } else { if ($this->option('commit')) { $this->info('Dropping database schema....'); $this->tool->dropSchema($this->metadata->getAllMetadata()); $this->info('Schema has been dropped!'); } else { $this->comment("Warning: this command can cause data loss. Run with --sql or --commit."); } } }
public function fire() { $this->info('Checking if database needs updating....'); $sql = $this->tool->getUpdateSchemaSql($this->metadata->getAllMetadata(), $this->option('clean')); if (empty($sql)) { $this->info('No updates found.'); return; } if ($this->option('sql')) { $this->info('Outputting update query:'); $this->info(implode(';' . PHP_EOL, $sql) . ';'); } else { if ($this->option('commit')) { $this->info('Updating database schema....'); $this->tool->updateSchema($this->metadata->getAllMetadata()); $this->info('Schema has been updated!'); } else { $this->comment("Warning: this command can cause data loss. Run with --sql or --commit."); } } }