forked from userfrosting/UserFrosting
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGroupsTable.php
61 lines (54 loc) · 1.77 KB
/
GroupsTable.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?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\v400;
use Illuminate\Database\Schema\Blueprint;
use UserFrosting\Sprinkle\Core\Database\Migration;
use UserFrosting\Sprinkle\Core\Facades\Seeder;
/**
* Groups table migration
* "Group" now replaces the notion of "primary group" in earlier versions of UF. A user can belong to exactly one group.
* Version 4.0.0.
*
* See https://laravel.com/docs/5.8/migrations#tables
*
* @author Alex Weissman (https://alexanderweissman.com)
*/
class GroupsTable extends Migration
{
/**
* {@inheritdoc}
*/
public function up()
{
if (!$this->schema->hasTable('groups')) {
$this->schema->create('groups', function (Blueprint $table) {
$table->increments('id');
$table->string('slug');
$table->string('name');
$table->text('description')->nullable();
$table->string('icon', 100)->nullable(false)->default('fa fa-user')->comment('The icon representing users in this group.');
$table->timestamps();
$table->engine = 'InnoDB';
$table->collation = 'utf8_unicode_ci';
$table->charset = 'utf8';
$table->unique('slug');
$table->index('slug');
});
// Add default groups
Seeder::execute('DefaultGroups');
}
}
/**
* {@inheritdoc}
*/
public function down()
{
$this->schema->drop('groups');
}
}