12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?php
-
- use Illuminate\Database\Migrations\Migration;
- use Illuminate\Database\Schema\Blueprint;
-
- class CreateStudentsTable extends Migration {
-
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- Schema::create('students', function(Blueprint $table)
- {
- $table->engine = 'InnoDB';
- $table->increments('id');
- $table->char('number', 9);
- $table->string('name', 100);
- $table->integer('program_id')->unsigned()->nullable();
-
- $table->timestamps();
- });
-
- Schema::table('students', function(Blueprint $table)
- {
- $table->foreign('program_id')->references('id')->on('programs')->onDelete('cascade')->onUpdate('cascade');
- });
- }
-
-
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- Schema::drop('students');
- }
-
- }
|