Run database migrations and seeders.

@author Morten Rugaard <moru@nodes.dk>

@return void
775410
final protected function runDatabaseMigrationsAndSeeders()
    {
        // Ask to migrate the database,
        // if we've copied any migration files to the application.
        if (!empty($this->migrations) && $this->getCommand()->confirm('Do you wish to migrate your database?', true)) {
            try {
                $this->getCommand()->call('migrate');
            } catch (Exception $e) {
                $this->getCommand()->error(sprintf('Could not migrate your database. Reason: %s', $e->getMessage()));
            }
        }

        // Before we ask user to seed the database
        // we need to have look in the $seeders array
        // to remove folders from the array
        $seeders = [];
        foreach ($this->seeders as $seeder) {
            if (is_dir(base_path($seeder))) {
                continue;
            }
            $seeders[] = $seeder;
        }

        // Ask to seed the database,
        // if we've copied any migration files to the application.
        if (!empty($seeders) && $this->getCommand()->confirm('Do you wish to seed your database?', true)) {
            // Load seeders directory so new seeders are available
            load_directory($this->getInstaller()->getBasePath('database/seeds/'));

            // Run package seeders
            foreach ($seeders as $seeder) {
                try {
                    $seederFilename = substr($seeder, strrpos($seeder, '/') + 1);
                    $this->getCommand()->call('db:seed', [
                        '--class' => substr($seederFilename, 0, strrpos($seederFilename, '.')),
                    ]);
                } catch (Exception $e) {
                    $this->getCommand()->error(sprintf('Could not seed database. Reason: %s', $e->getMessage()));
                }
            }
        }
    }
155076
public function up()
    {
        Schema::connection($this->connection)->create('provider', function (Blueprint $table) {
            $table->increments('id', true);
            $table->string('firstname');
            $table->string('lastname');
            $table->string('practice_name');
            $table->string('address');
            $table->string('town');
            $table->string('state')->nullable();
            $table->string('country')->nullable();
            $table->string('email')->nullable();
        });
    }
1314267
public function up(): void
    {
        Schema::create(config('rinvex.tenants.tables.tenants'), function (Blueprint $table) {
            // Columns
            $table->increments('id');
            $table->string('slug');
            $table->{$this->jsonable()}('name');
            $table->{$this->jsonable()}('description')->nullable();
            $table->morphs('owner');
            $table->string('email');
            $table->string('website')->nullable();
            $table->string('phone')->nullable();
            $table->string('language_code', 2);
            $table->string('country_code', 2);
            $table->string('state')->nullable();
            $table->string('city')->nullable();
            $table->string('address')->nullable();
            $table->string('postal_code')->nullable();
            $table->date('launch_date')->nullable();
            $table->string('timezone')->nullable();
            $table->string('currency')->nullable();
            $table->boolean('is_active')->default(true);
            $table->timestamps();
            $table->softDeletes();

            // Indexes
            $table->unique('slug');
        });
    }
1183544
public function up()
    {
        Schema::table('users', function (Blueprint $table) {
            $table->enum('type', array_values(UserType::toArray()))->default(UserType::__default);
            $table->boolean('is_active')->default(true);
            $table->dateTime('last_login_at')->nullable();
            $table->integer('login_count')->unsigned()->nullable()->default(0);
            $table->softDeletes();
        });
    }
1299746
public function up()
    {
        Schema::create('categories', function (Blueprint $table) {
            $table->increments('id');
            // nested sets fields
            $table->unsignedInteger('parent_id')->nullable()->index();
            $table->unsignedInteger('lft')->nullable()->index();
            $table->unsignedInteger('rgt')->nullable()->index();
            $table->unsignedInteger('depth')->nullable();

            $table->string('title');
            $table->string('alias')->index();
            $table->string('note')->nullable();
            $table->boolean('published')->default(false)->index();
            $table->boolean('authenticated')->default(false)->index();
            $table->integer('hits')->default(0);
            $table->mediumText('description')->nullable();
            $table->text('parameters')->nullable();

            $table->unsignedInteger('created_by')->nullable()->index();
            $table->unsignedInteger('updated_by')->nullable()->index();
            $table->timestamps();
        });
    }
715877
public function up()
    {
        $tableOptions = null;
        if ($this->db->driverName === 'mysql') {
            $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
        }

        $this->createTable('{{%Comment}}', [
            'id' => Schema::TYPE_PK,
            'entity' => 'CHAR(10) NOT NULL',
            'entityId' => Schema::TYPE_INTEGER . ' NOT NULL',
            'content' => Schema::TYPE_TEXT . ' NOT NULL',
            'parentId' => Schema::TYPE_INTEGER . ' DEFAULT NULL',
            'level' => 'TINYINT(3) NOT NULL DEFAULT 1',
            'anonymousUsername' => Schema::TYPE_STRING,
            'createdBy' => Schema::TYPE_INTEGER,
            'updatedBy' => Schema::TYPE_INTEGER,
            'status' => 'TINYINT(2) NOT NULL DEFAULT 1',
            'createdAt' => Schema::TYPE_INTEGER . ' NOT NULL',
            'updatedAt' => Schema::TYPE_INTEGER . ' NOT NULL',
        ], $tableOptions);

        $this->createIndex('comment_entity_index', '{{%Comment}}', 'entity');
        $this->createIndex('comment_status_index', '{{%Comment}}', 'status');
        $this->createIndex('comment_complete_entity_index', '{{%Comment}}', ['entity', 'entityId']);
        $this->createIndex('comment_parent_index', '{{%Comment}}', 'parentId');
        $this->createIndex('comment_author_index', '{{%Comment}}', 'createdBy');
    }
1187239
public function runMigrations()
	{
		$migrations = Model::where('status', 'pending');

		if ($migrations->get()->size() > 0) {
			foreach($migrations->get()->all() as $migration) {
				$this->runSingleMigration($migration);
			}
		}
	}
508957
public function up()
    {
        Schema::create('statusable_status', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->morphs('statusable');
            $table->unsignedTinyInteger('status_id')->default(1);
            $table->string('reason')->nullable();
            $table->nullableMorphs('agent');
            $table->foreign('status_id')->references('id')->on('statuses');
            $table->timestamps();
        });
    }
841067
public function up()
    {
        Schema::table(config('lern.record.table'), function(Blueprint $table) {
            $table->integer('user_id')->nullable();
            $table->text('data')->nullable();
            $table->string('url')->nullable();
            $table->string('method')->nullable();
        });
    }
41954
public function up()
    {
        Schema::table('data_types', function (Blueprint $table) {
            $table->string('pagination', 10)->default('js')->after('generate_permissions');

            if (Schema::hasColumn('permissions', 'server_side')) {
                $table->dropColumn('server_side');
            }
        });
    }
968668
public function up()
    {
        Schema::table('notifications', function ($table) {
            $driver = Config::get('database.driver');

            if ($driver === 'mysql' || $driver === 'sqlite') {
                DB::statement('ALTER TABLE notifications MODIFY COLUMN extra json');
            } elseif ($driver === 'pgsql') {
                DB::statement('ALTER TABLE notifications ALTER COLUMN extra TYPE json USING code::string');
            }
        });
    }
768153
private function runMigration()
    {
        // Confirm connection and migration.
        $connection = $this->confirmConnectionAndMigration();

        // Load the migration class.
        $migration_class = $this->getMigrationClass();

        // Process the migration.
        $this->processMigration($connection, $migration_class);

        // Save this migration to the database/migrations folder.
        $this->createMigrationFile($connection, $migration_class);
    }
1147678
public function up()
    {
        Schema::create('components', function (Blueprint $table) {
            $table->engine = 'InnoDB';

            $table->increments('id');
            $table->string('name');
            $table->text('description');
            $table->text('link');
            $table->integer('status');
            $table->integer('order');
            $table->integer('group_id');
            $table->integer('user_id');
            $table->timestamps();
            $table->softDeletes();

            $table->index('group_id');
            $table->index('user_id');
            $table->index('status');
            $table->index('order');
        });
    }
1332825
public function up()
    {
        $connection = config('admin.database.connection') ?: config('database.default');

        $table = config('admin.extensions.config.table', 'admin_config');

        Schema::connection($connection)->create($table, function (Blueprint $table) {
            $table->increments('id');
            $table->string('name')->unique();
            $table->string('value');
            $table->text('description')->nullable();
            $table->timestamps();
        });
    }
938781
public function up()
    {
        Schema::create(config('cortex.auth.tables.roles'), function (Blueprint $table) {
            // Columns
            $table->increments('id');
            $table->string('name', 150);
            $table->{$this->jsonable()}('title')->nullable();
            $table->integer('level')->unsigned()->nullable();
            $table->integer('scope')->nullable();
            $table->auditableAndTimestamps();

            // Indexes
            $table->index(['scope']);
            $table->unique(['name', 'scope'], 'roles_name_unique');
        });
    }
1016486
public function up()
	{
		Schema::create('lang', function(Blueprint $table)
		{
			$table->boolean('id')->unique('id');
			$table->string('sname', 5)->nullable()->index('sname');
			$table->string('name', 100)->nullable();
			$table->integer('sort')->nullable()->index('sort');
			$table->boolean('primary')->nullable()->default(0)->index('primary_2');
			$table->boolean('active')->nullable()->default(1)->index('active');
			$table->boolean('active_front')->default(0);
			$table->string('image')->nullable();
		});
	}
1303002
public function up()
    {
        $this->createSchema(function (Blueprint $table) {
            $table->increments('id');
            $table->string('username');
            $table->string('first_name', 30)->nullable();
            $table->string('last_name', 30)->nullable();
            $table->string('email')->unique();
            $table->timestamp('email_verified_at')->nullable();
            $this->addCredentialsColumns($table);
            $table->rememberToken();
            $table->boolean('is_admin')->default(0);
            $table->timestamp('last_activity')->nullable();
            $table->timestamps();
            $table->timestamp('activated_at')->nullable();
            $table->softDeletes();
        });
    }