Column shipped_at dropped.
Illuminate\Database\QueryException {#27 +errorInfo: array:3 [ 0 => "42501" 1 => 7 2 => "ERROR: must be owner of relation orders" ] +connectionName: "pgsql" #sql: "alter table "orders" drop column "shipped_at"" #bindings: [] }
throw new UniqueConstraintViolationException( $this->getName(), $query, $this->prepareBindings($bindings), $e ); } throw new QueryException( $this->getName(), $query, $this->prepareBindings($bindings), $e ); } } // Here we will run this query. If an exception occurs we'll determine if it was // caused by a connection that has been lost. If that is the cause, we'll try // to re-establish connection and re-run the query with a fresh connection. try { $result = $this->runQueryCallback($query, $bindings, $callback); } catch (QueryException $e) { $result = $this->handleQueryException( $e, $query, $bindings, $callback ); } * @param array $bindings * @return bool */ public function statement($query, $bindings = []) { return $this->run($query, $bindings, function ($query, $bindings) { if ($this->pretending()) { return true; } $statement = $this->getPdo()->prepare($query); * @return void */ public function build(Connection $connection, Grammar $grammar) { foreach ($this->toSql($connection, $grammar) as $statement) { $connection->statement($statement); } } /** * Get the raw SQL statements for the blueprint. * @param \Illuminate\Database\Schema\Blueprint $blueprint * @return void */ protected function build(Blueprint $blueprint) { $blueprint->build($this->connection, $this->grammar); } /** * Create a new command set with a Closure. * * @param \Closure $callback * @return void */ public function table($table, Closure $callback) { $this->build($this->createBlueprint($table, $callback)); } /** * Create a new table on the schema. * if (! $instance) { throw new RuntimeException('A facade root has not been set.'); } return $instance->$method(...$args); }}$app = require __DIR__ . '/../bootstrap/app.php';use Illuminate\Support\Facades\Schema;use Illuminate\Database\Schema\Blueprint;Schema::table('orders', function (Blueprint $table) { if (Schema::hasColumn('orders', 'shipped_at')) { $table->dropColumn('shipped_at'); echo "Column shipped_at dropped.\n"; } else { echo "Column shipped_at does not exist.\n"; $this->bindValues($statement, $this->prepareBindings($bindings)); $this->recordsHaveBeenModified(); return $statement->execute(); }); } /** * Run an SQL statement and get the number of rows affected. $this->bindValues($statement, $this->prepareBindings($bindings)); $this->recordsHaveBeenModified(); return $statement->execute(); }); } /** * Run an SQL statement and get the number of rows affected. { // To execute the statement, we'll simply call the callback, which will actually // run the SQL against the PDO connection. Then we can calculate the time it // took to execute and log the query SQL, bindings and time in our memory. try { return $callback($query, $bindings); } // If an exception occurs when attempting to run a query, we'll format the error // message to include the bindings with SQL, which will make this exception a // lot more helpful to the developer instead of just the database's errors. // Here we will run this query. If an exception occurs we'll determine if it was // caused by a connection that has been lost. If that is the cause, we'll try // to re-establish connection and re-run the query with a fresh connection. try { $result = $this->runQueryCallback($query, $bindings, $callback); } catch (QueryException $e) { $result = $this->handleQueryException( $e, $query, $bindings, $callback ); } * @param array $bindings * @return bool */ public function statement($query, $bindings = []) { return $this->run($query, $bindings, function ($query, $bindings) { if ($this->pretending()) { return true; } $statement = $this->getPdo()->prepare($query); * @return void */ public function build(Connection $connection, Grammar $grammar) { foreach ($this->toSql($connection, $grammar) as $statement) { $connection->statement($statement); } } /** * Get the raw SQL statements for the blueprint. * @param \Illuminate\Database\Schema\Blueprint $blueprint * @return void */ protected function build(Blueprint $blueprint) { $blueprint->build($this->connection, $this->grammar); } /** * Create a new command set with a Closure. * * @param \Closure $callback * @return void */ public function table($table, Closure $callback) { $this->build($this->createBlueprint($table, $callback)); } /** * Create a new table on the schema. * if (! $instance) { throw new RuntimeException('A facade root has not been set.'); } return $instance->$method(...$args); }}$app = require __DIR__ . '/../bootstrap/app.php';use Illuminate\Support\Facades\Schema;use Illuminate\Database\Schema\Blueprint;Schema::table('orders', function (Blueprint $table) { if (Schema::hasColumn('orders', 'shipped_at')) { $table->dropColumn('shipped_at'); echo "Column shipped_at dropped.\n"; } else { echo "Column shipped_at does not exist.\n";|
[2/2]
QueryException
|
|---|
Illuminate\Database\QueryException:
SQLSTATE[42501]: Insufficient privilege: 7 ERROR: must be owner of relation orders (Connection: pgsql, SQL: alter table "orders" drop column "shipped_at")
at /home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Connection.php:829
at Illuminate\Database\Connection->runQueryCallback('alter table "orders" drop column "shipped_at"', array(), object(Closure))
(/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Connection.php:783)
at Illuminate\Database\Connection->run('alter table "orders" drop column "shipped_at"', array(), object(Closure))
(/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Connection.php:576)
at Illuminate\Database\Connection->statement('alter table "orders" drop column "shipped_at"')
(/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Schema/Blueprint.php:110)
at Illuminate\Database\Schema\Blueprint->build(object(PostgresConnection), object(PostgresGrammar))
(/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Schema/Builder.php:602)
at Illuminate\Database\Schema\Builder->build(object(Blueprint))
(/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Schema/Builder.php:444)
at Illuminate\Database\Schema\Builder->table('orders', object(Closure))
(/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/support/Facades/Facade.php:355)
at Illuminate\Support\Facades\Facade::__callStatic('table', array('orders', object(Closure)))
(/home/vzizxmil/public_html/banyal-connect-api/scratch/drop_shipped_at_col.php:8)
|
|
[1/2]
PDOException
|
|---|
PDOException:
SQLSTATE[42501]: Insufficient privilege: 7 ERROR: must be owner of relation orders
at /home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Connection.php:587
at PDOStatement->execute()
(/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Connection.php:587)
at Illuminate\Database\Connection->{closure:Illuminate\Database\Connection::statement():576}('alter table "orders" drop column "shipped_at"', array())
(/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Connection.php:816)
at Illuminate\Database\Connection->runQueryCallback('alter table "orders" drop column "shipped_at"', array(), object(Closure))
(/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Connection.php:783)
at Illuminate\Database\Connection->run('alter table "orders" drop column "shipped_at"', array(), object(Closure))
(/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Connection.php:576)
at Illuminate\Database\Connection->statement('alter table "orders" drop column "shipped_at"')
(/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Schema/Blueprint.php:110)
at Illuminate\Database\Schema\Blueprint->build(object(PostgresConnection), object(PostgresGrammar))
(/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Schema/Builder.php:602)
at Illuminate\Database\Schema\Builder->build(object(Blueprint))
(/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Schema/Builder.php:444)
at Illuminate\Database\Schema\Builder->table('orders', object(Closure))
(/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/support/Facades/Facade.php:355)
at Illuminate\Support\Facades\Facade::__callStatic('table', array('orders', object(Closure)))
(/home/vzizxmil/public_html/banyal-connect-api/scratch/drop_shipped_at_col.php:8)
|