Ejemplo n.º 1
0
 public function renameTable()
 {
     $sql = "RENAME TABLE `" . $this->savedPropertyValues['name'] . "` TO `" . $this->properties['name'] . "`;";
     $this->application->dataLink->query($sql);
     if ($this->migration) {
         $this->migration->addCommit("Переименование связи `{$this->properties['name']}`");
         $this->migration->addObject($this->properties['name']);
         $this->migration->addSql("update referenceMap set `name` = " . $this->application->dataLink->quoteSmart($this->properties['name']) . " where `name` = " . $this->application->dataLink->quoteSmart($this->savedPropertyValues['name']) . "");
         $this->migration->addSql($sql);
     }
     $this->application->log->add($sql);
 }
Ejemplo n.º 2
0
 public function parseParam()
 {
     global $argv;
     array_shift($argv);
     $argv = array_values($argv);
     $argvKeys = array_fill_keys($argv, '');
     $m = array_shift($argv);
     if ($m === '-m') {
         $this->migration->createDB();
         if (array_key_exists('create', $argvKeys)) {
             array_shift($argv);
             $nameAuthor = null;
             if (count($argv) > 0) {
                 $nameAuthor = array_shift($argv);
             }
             $this->createMigration($nameAuthor);
         } elseif (array_key_exists('migrate', $argvKeys)) {
             array_shift($argv);
             $nameAuthor = null;
             if (count($argv) == 1) {
                 $nameAuthor = array_shift($argv);
             } elseif (count($argv) > 1) {
                 $nameAuthor = $argv;
             }
             $this->migrate($nameAuthor);
         } elseif (array_key_exists('list', $argvKeys)) {
             $this->listMigrate();
         } else {
             $this->help();
         }
     } elseif ($m === 'help') {
         $this->help();
     } else {
         $this->help();
     }
 }