古いテーブルのデータを新しいテーブルにコピーすることはできますか?私たちは、現在のテーブルにすべてのデータを新しく作成した テーブルに渡す大規模なデータベースの再配置を計画しています。Laravel 5で古いテーブルから新しいテーブルに移行するデータ移行
私たちはここに私の移行だ、ニュースフィードやなどのために件のデータを処理するためには簡単だろうことに気づい:ここ
/*students table*/
public function up()
{
Schema::create('students', function (Blueprint $table) {
$table->increments('id');
$table->string('lname');
$table->string('mname')->nullable();
$table->string('fname');
$table->char('gender', 1);
$table->date('date_of_birth');
$table->string('address');
$table->tinyInteger('yr_lvl');
$table->string('contact_no');
$table->text('about_me')->nullable();
$table->text('education')->nullable();
$table->text('achievements')->nullable();
$table->text('seminars')->nullable();
$table->text('organizations')->nullable();
$table->tinyInteger('status')->default(1);
$table->timestamps();
});
}
/*newly created table works*/
Schema::create('works', function (Blueprint $table) {
$table->increments('id');
$table->integer('student_id')->unsigned()->nullable();
$table->foreign('student_id')->references('id')->on('students')->onDelete('cascade');
$table->text('about_me')->nullable();
$table->timestamps();
});
を移行実行'テーブル(別の構造を持つ)? –
いいえ私はちょうど新しいテーブルにいくつかのデータ(about_me)をコピーしたいと思います...私は他のテーブル(作品)を見ることができます私のフィールドと学生からの外国キー –