Ruckusing_Adapter_PgSQL_Base::remove_timestamps PHP Method

remove_timestamps() public method

Remove timestamps
public remove_timestamps ( string $table_name, string $created_column_name, string $updated_column_name ) : boolean
$table_name string The table name
$created_column_name string Created at column name
$updated_column_name string Updated at column name
return boolean
    public function remove_timestamps($table_name, $created_column_name, $updated_column_name)
    {
        if (empty($table_name)) {
            throw new Ruckusing_Exception("Missing table name parameter", Ruckusing_Exception::INVALID_ARGUMENT);
        }
        if (empty($created_column_name)) {
            throw new Ruckusing_Exception("Missing created at column name parameter", Ruckusing_Exception::INVALID_ARGUMENT);
        }
        if (empty($updated_column_name)) {
            throw new Ruckusing_Exception("Missing updated at column name parameter", Ruckusing_Exception::INVALID_ARGUMENT);
        }
        $created_at = $this->remove_column($table_name, $created_column_name);
        $updated_at = $this->remove_column($table_name, $updated_column_name);
        return $created_at && $updated_at;
    }

Usage Example

Beispiel #1
0
 /**
  * Remove timestamps
  *
  * @param string $table_name  the name of the table
  * @param string $created_column_name Created at column name
  * @param string $updated_column_name Updated at column name
  *
  * @return boolean
  */
 public function remove_timestamps($table_name, $created_column_name = "created_at", $updated_column_name = "updated_at")
 {
     return $this->_adapter->remove_timestamps($table_name, $created_column_name, $updated_column_name);
 }