カラムを削除する "php artisan migrate:rollback"を実行中にエラーが発生しました。マイグレーション時のエラー:カラムを削除するロールバック - Laravel Homestead&SQliteを使用
は、私はすでに走ってきました:
1.作曲が必要教義/ DBAL
2.作曲更新
私が使用してデータベーススキーマを確認すると、私も「作曲・ダンプ・自動ロード」
を試してみました3。 : "sqlite3 database/database.sqlite"テーブルには、すべての列が含まれています(抜け落ちるはずの "抜粋"を含む)が含まれますが、ロールバックを実行すると、列が公開されていないというエラーが表示されます。下記参照。
(環境:laravel 5.3-ステッド、Gitbash、崇高なテキスト3、sqlite3の)
次のようにエラーが次のよう
[Illuminate\Database\QueryException]
SQLSTATE[HY000]: General error: 1 no such column: published (SQL: CREATE TEMPORARY TABLE __temp__articles AS SELECT id, title, body, created_at, updated_at, published at FROM articles)
[Doctrine\DBAL\Driver\PDOException]
SQLSTATE[HY000]: General error: 1 no such column: published
[PDOException]
SQLSTATE[HY000]: General error: 1 no such column: published
私のスキーマは次のとおり
CREATE TABLE "migrations" ("id" integer not null primary key autoincrement, "migration" varchar not null, "batch" integer not null);
CREATE TABLE "users" ("id" integer not null primary key autoincrement, "name" varchar not null, "email" varchar not null, "password" varchar not null, "remember_token" varchar null, "created_at" datetime null, "updated_at" datetime null);
CREATE UNIQUE INDEX "users_email_unique" on "users" ("email");
CREATE TABLE "password_resets" ("email" varchar not null, "token" varchar not null, "created_at" datetime null);
CREATE INDEX "password_resets_email_index" on "password_resets" ("email");
CREATE INDEX "password_resets_token_index" on "password_resets" ("token");
CREATE TABLE "articles" ("id" integer not null primary key autoincrement, "title" varchar not null, "body" text not null, "created_at" datetime null, "updated_at" datetime null, "published at" datetime not null, "excerpt" text null);
列を作成した移行は次のとおりです。
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddExcerptToArticlesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('articles', function (Blueprint $table) {
$table->text("excerpt")->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('articles', function (Blueprint $table) {
$table->dropColumn("excerpt");
});
}
}
これを解決して、migrate:rollbackを使用して列をシームレスに削除できるようにしますか?