Example #1
0
 /**
  * Check if current environment is safe to run migration.
  *
  * @return bool
  */
 protected function verifyEnvironment()
 {
     if ($this->option('force') || $this->config->isSafe()) {
         //Safe to run
         return true;
     }
     $this->writeln("<fg=red>Confirmation is required to run migrations!</fg=red>");
     if (!$this->ask()->confirm("Do you wish to continue?")) {
         $this->writeln("<comment>Cancelling operation...</comment>");
         return false;
     }
     return true;
 }
Example #2
0
 /**
  * Request new migration filename based on user input and current timestamp.
  *
  * @param string $name
  * @return string
  */
 private function createFilename($name)
 {
     $name = Inflector::tableize($name);
     $filename = \Spiral\interpolate(self::FILENAME_FORMAT, ['timestamp' => date(self::TIMESTAMP_FORMAT), 'chunk' => $this->chunkID++, 'name' => $name]);
     return $this->files->normalizePath($this->config->getDirectory() . '/' . $filename);
 }
Example #3
0
 /**
  * Migration table, all migration information will be stored in it.
  *
  * @return Table
  */
 protected function stateTable()
 {
     return $this->dbal->database($this->config->getDatabase())->table($this->config->getTable());
 }