1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
-
- use Illuminate\Database\Schema\Blueprint;
- use Illuminate\Database\Migrations\Migration;
-
- class CreateStudentsTable extends Migration
- {
-
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- Schema::create('students', function (Blueprint $table) {
-
- $table->increments('id');
- $table->char('number', 9);
- $table->string('name', 100);
- $table->char('school_code', 2)->nullable();
- $table->char('conc_code', 4)->nullable();
- $table->string('email', 40)->default('no.email.olas@upr.edu');
- $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');
- }
- }
|