| Total Complexity | 2 |
| Total Lines | 27 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | class CreateUsersTable extends Migration |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * Run the migrations. |
||
| 11 | */ |
||
| 12 | public function up() |
||
| 13 | { |
||
| 14 | Schema::create('users', function (Blueprint $table) { |
||
| 15 | //primary |
||
| 16 | $table->unsignedInteger('user_id'); |
||
| 17 | $table->unsignedInteger('organization_id'); |
||
| 18 | $table->primary(['user_id', 'organization_id']); |
||
| 19 | //related user |
||
| 20 | $table->unsignedInteger('referred_by_user_id')->nullable(); |
||
| 21 | $table->unsignedInteger('referred_by_organization_id')->nullable(); |
||
| 22 | $table->string('name')->unique(); |
||
| 23 | $table->unsignedInteger('counter')->default(0); |
||
| 24 | $table->timestamps(); |
||
| 25 | }); |
||
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Reverse the migrations. |
||
| 30 | */ |
||
| 31 | public function down() |
||
| 34 | } |
||
| 35 | } |
||
| 36 |