Exemplo n.º 1
0
 protected function addOrRenameSequence($old, $new)
 {
     /*
      * Prior to the existence of this method, both
      * addSequence and renameSequence were called,
      * but possibly in wrong order, leading to is-
      * sues like bugzilla #29635.
      * This means we must first detect whether the
      * sequences both already exist and have quite
      * a problem then. Normally, we'd need to keep
      * the higher of them by some complicated code
      * in PL/PGSQL (this has already been done for
      * a sequence in Evolvis), but since this only
      * affects two sequences, and only for a short
      * period of time, we can just assume that the
      * old sequence is to be kept and the newer to
      * be deleted.
      * If only old exists, rename that, otherwise,
      * create new.
      */
     if ($this->db->sequenceExists($old)) {
         if ($this->db->sequenceExists($new)) {
             $this->output("Removing sequence {$new}\n");
             $this->db->query("DROP SEQUENCE {$new}");
         }
         $this->renameSequence($old, $new);
     } else {
         $this->addSequence($new);
     }
 }
 protected function renameSequence($old, $new)
 {
     if ($this->db->sequenceExists($new)) {
         $this->output("...sequence {$new} already exists.\n");
         return;
     }
     if ($this->db->sequenceExists($old)) {
         $this->output("Renaming sequence {$old} to {$new}\n");
         $this->db->query("ALTER SEQUENCE {$old} RENAME TO {$new}");
     }
 }
Exemplo n.º 3
0
	protected function renameSequence( $old, $new ) {
		if ( $this->db->sequenceExists( $new ) ) {
			$this->output( "...sequence $new already exists.\n" );

			return;
		}
		if ( $this->db->sequenceExists( $old ) ) {
			$this->output( "Renaming sequence $old to $new\n" );
			$this->db->query( "ALTER SEQUENCE $old RENAME TO $new" );
		}
	}