本文整理汇总了PHP中Illuminate\Database\Schema\Builder::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Builder::create方法的具体用法?PHP Builder::create怎么用?PHP Builder::create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Database\Schema\Builder
的用法示例。
在下文中一共展示了Builder::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: up
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$this->schema->create('roles', function (Blueprint $table) {
$table->increments('id');
$table->string('name')->unique();
});
}
示例2: up
/**
* Run the migrations.
*/
public function up()
{
$this->schema->create('password_resets', function (Blueprint $table) {
$table->string('email')->index();
$table->string('token')->index();
$table->timestamp('created_at');
});
}
示例3: up
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$this->schema->create('ages', function (Blueprint $table) {
$table->increments('id');
$table->string('from');
$table->string('to');
});
}
示例4: up
/**
* Do the migration
*/
public function up()
{
//Create
$this->schema->create('account_status', function ($table) {
$table->increments('id');
$table->string('value', 200);
$table->dateTime('created_at')->default(DB::raw('CURRENT_TIMESTAMP'));
});
}
示例5: up
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$this->schema->create('notifications', function (Blueprint $table) {
$table->increments('id');
$table->string('title');
$table->string('body');
$table->dateTime('release_date');
$table->timestamps();
});
}
示例6: handle
/**
* Install the extensions table.
*/
public function handle()
{
$this->schema->dropIfExists('addons_extensions');
$this->schema->create('addons_extensions', function (Blueprint $table) {
$table->increments('id');
$table->string('slug');
$table->boolean('installed')->default(0);
$table->boolean('enabled')->default(0);
});
}
示例7: up
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$this->schema->create('user_roles', function (Blueprint $table) {
$table->increments('id');
$table->integer('user_id')->unsigned()->index();
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
$table->integer('role_id')->unsigned()->index();
$table->foreign('role_id')->references('id')->on('roles')->onDelete('cascade');
});
}
示例8: up
/**
* Do the migration
*/
public function up()
{
$this->schema->create('posts', function ($table) {
$table->increments('id');
$table->integer('user_id')->unsigned();
$table->text('content');
$table->timestamps();
$table->softDeletes();
$table->foreign('user_id')->references('id')->on('users');
});
}
示例9: up
/**
* Do the migration
*/
public function up()
{
//Create table
$this->schema->create('ci_sessions', function ($table) {
$table->string('session_id', 40);
$table->string('ip_address', 45);
$table->string('user_agent', 120);
$table->integer('last_activity')->unsigned();
$table->text('user_data');
});
}
示例10: up
/**
* Run the migrations.
*/
public function up()
{
$this->schema->create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('email')->unique();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
}
示例11: up
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$this->schema->create('products', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('code')->unique();
$table->string('image');
$table->string('poster');
$table->timestamps();
});
}
示例12: up
/**
* Do the migration
*/
public function up()
{
//Creates contents table
$this->schema->create('contents', function ($table) {
$table->increments('id');
$table->string('title');
$table->text('text');
$table->timestamps();
$table->softDeletes();
});
}
示例13: up
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$this->schema->create('profiles', function (Blueprint $table) {
$table->increments('id');
$table->string('image');
$table->longText('description');
$table->integer('product_id')->unsigned()->index();
$table->foreign('product_id')->references('id')->on('products')->onDelete('cascade');
$table->timestamps();
});
}
示例14: up
/**
* Do the migration
*/
public function up()
{
$this->schema->create('likes', function ($table) {
$table->increments('id');
$table->integer('user_id')->unsigned();
$table->string('resourceable_type');
$table->string('resourceable_id');
$table->timestamps();
$table->softDeletes();
$table->foreign('user_id')->references('id')->on('users');
});
}
示例15: runTestMigrations
/**
* Run migrations for tables only used for testing purposes.
*
* @return void
*/
protected function runTestMigrations()
{
include_once __DIR__ . '/../resources/migrations/create_adjustments_table.php.stub';
(new \CreateAdjustmentsTable())->up();
if (!$this->schema->hasTable('fruits')) {
$this->schema->create('fruits', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->integer('price');
});
}
}