-
-
Notifications
You must be signed in to change notification settings - Fork 366
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #964 from amosfolz/issue-#867
Allow null group assignment for users (Issue #867)
- Loading branch information
Showing
6 changed files
with
107 additions
and
41 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
app/sprinkles/account/src/Database/Migrations/v430/UpdateUsersTable.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
|
||
/* | ||
* UserFrosting (http://www.userfrosting.com) | ||
* | ||
* @link https://github.com/userfrosting/UserFrosting | ||
* @copyright Copyright (c) 2019 Alexander Weissman | ||
* @license https://github.com/userfrosting/UserFrosting/blob/master/LICENSE.md (MIT License) | ||
*/ | ||
|
||
namespace UserFrosting\Sprinkle\Account\Database\Migrations\v430; | ||
|
||
use Illuminate\Database\Schema\Blueprint; | ||
use UserFrosting\Sprinkle\Core\Database\Migration; | ||
|
||
/** | ||
* Groups table migration | ||
* Changes `group_id` column properties to allow user to be created without a group. | ||
* Version 4.3.0. | ||
* | ||
* See https://laravel.com/docs/5.4/migrations#tables | ||
* | ||
* @author Amos Folz | ||
*/ | ||
class UpdateUsersTable extends Migration | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public static $dependencies = [ | ||
'\UserFrosting\Sprinkle\Account\Database\Migrations\v400\GroupsTable', | ||
'\UserFrosting\Sprinkle\Account\Database\Migrations\v400\UsersTable', | ||
'\UserFrosting\Sprinkle\Account\Database\Migrations\v420\AddingForeignKeys', | ||
]; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function up() | ||
{ | ||
if ($this->schema->hasTable('users')) { | ||
$this->schema->table('users', function (Blueprint $table) { | ||
$table->unsignedInteger('group_id')->default(null)->comment('The id of the user group.')->nullable()->change(); | ||
}); | ||
} | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function down() | ||
{ | ||
$this->schema->table('users', function (Blueprint $table) { | ||
$table->unsignedInteger('group_id')->default(1)->comment('The id of the user group.')->change(); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters