67 lines
2.1 KiB
PHP
67 lines
2.1 KiB
PHP
<?php
|
|
|
|
/*
|
|
* AVSDev UF Organisations (https://avsdev.uk)
|
|
*
|
|
* @link https://git.avsdev.uk/avsdev/sprinkle-organisations
|
|
* @license https://git.avsdev.uk/avsdev/sprinkle-organisations/blob/master/LICENSE.md (LGPL-3.0 License)
|
|
*/
|
|
|
|
namespace UserFrosting\Sprinkle\Organisations\Database\Migrations\v1_0_0;
|
|
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use UserFrosting\Sprinkle\Organisations\Database\Models\Organisation;
|
|
use UserFrosting\Sprinkle\Core\Database\Migration;
|
|
use UserFrosting\Sprinkle\Core\Facades\Seeder;
|
|
|
|
/**
|
|
* Organisations table migration
|
|
* "Organisations" are intended to replace groups by providing logical grouping where users may be in none or more organisations.
|
|
* Version 1.0.0.
|
|
*
|
|
* @author Craig Williams (https://avsdev.uk)
|
|
*/
|
|
class OrganisationsTable extends Migration
|
|
{
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public static $dependencies = [
|
|
'\UserFrosting\Sprinkle\Account\Database\Migrations\v430\UpdateUsersTable',
|
|
];
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function up()
|
|
{
|
|
if (!$this->schema->hasTable('organisations')) {
|
|
$this->schema->create('organisations', function (Blueprint $table) {
|
|
$table->increments('id');
|
|
$table->string('slug');
|
|
$table->string('name');
|
|
$table->text('description')->nullable();
|
|
$table->integer('registrant_id')->unsigned()->nullable();
|
|
$table->boolean('flag_approved')->default(1)->comment('Set to 1 if the organisation has been approved, 0 otherwise.');
|
|
$table->softDeletes();
|
|
$table->timestamps();
|
|
|
|
$table->engine = 'InnoDB';
|
|
$table->collation = 'utf8_unicode_ci';
|
|
$table->charset = 'utf8';
|
|
$table->foreign('registrant_id')->references('id')->on('users');
|
|
$table->unique('slug');
|
|
$table->index('slug');
|
|
});
|
|
}
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function down()
|
|
{
|
|
$this->schema->drop('organisations');
|
|
}
|
|
}
|