ドットインストールにて、lalavelの学習をしていたのですが、こちらの動画内で、つまずいてしまった為、ご助言頂きたく、ご質問させていただきました。
解決できない部分につきまして、ご説明させていただきます。
Puttyにて、virtualboxにログインし、laravelをインストール後、laravelのデータベースフォルダの中の「migrations」フォルダの中にある、「2019_03_09_143457_create_posts_table.php」の中身を以下のように変更しました。
<?php use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreatePostsTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('posts', function (Blueprint $table) { $table->Increments('id'); $table->string('title'); $table->text('body'); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('posts'); } }
変更しました部分は、カラムを追加する為、
「$table->string('title');
$table->text('body');」
こちらの2行を追加し、その後、Puttyにて、「php artisan mygrate」を実行しました。そして、テーブルの構成を表示する為、sqliteにて、「.schema posts」としましたら、以下のように表示されました。
CREATE TABLE "posts" ("id" integer not null primary key autoincrement, "title" varchar not null, "b ody" text not null);
ここで、気が付いたのですが、実は、元々は「$table->timestamps();」こちらの行が「$table->text('body');」の次の行に追加されていたのですが、間違えて消してしまったことに気づき、「$table->timestamps();」こちらの行を追記しました。
そして、再度テーブルをアップデートする為、「php artisan migrate」としましたら、「Nothing to migrate」
と表示され、テーブルを再度、「.schema posts」とし、確認したのですが、カラムは追加されていませんでした。
カラムを追加する方法につきまして、どなたかご助言頂ければ幸いです。よろしくお願いします

回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/03/10 11:25