コード例 #1
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     //Create Migration Files
     if ($this->option('from') != "") {
         $from = $this->option('from');
     } else {
         $from = $this->ask('What database do you want to be synchronized?');
     }
     if ($this->option('to') != "") {
         $to = $this->option('to');
     } else {
         $to = $this->ask('What database do you want to receive the synchronized data?');
     }
     $this->comment("Migrating from {$from} to {$to}.");
     $this->comment(PHP_EOL . SyncScript::Generate($from, $to) . PHP_EOL);
 }
コード例 #2
0
 public static function Generate($database, $backup)
 {
     $syncScript = new SyncScript();
     if ($database != "") {
         $syncScript->SetDatabase($database);
     }
     if ($backup != "") {
         $syncScript->SetBackup($backup);
     }
     $tables = $syncScript->GetTables();
     $fullSync = "";
     foreach ($tables as $table) {
         $tablename = $table[0];
         $fullSync .= $syncScript->CreateSyncScript($tablename) . PHP_EOL . PHP_EOL . PHP_EOL;
     }
     $syncScript->CreateFullSyncScript($fullSync);
     return "New SyncScript Files Created in " . self::GetSyncDirectory();
 }