分享 推播通知
目前身份: 訪客

這個是用php artisan指令的方法,使用make:migration,去建立生成一個在database/migrations底下的一支php

估計他是要用搬遷的時候,由這些的php去產生資料表、欄位的更動等等,而不是在phpmyadmin上的操作

所以具體的指令如下:

 

xx@xx:/test2/blog$ php artisan make:migration create_posts_table
Created Migration: 2019_03_28_034302_create_posts_table

 

這樣就建立好了

 

 

建立好後的檔案就是長這個樣子

database/migrations/2019_03_28_034302_create_posts_table.php

use IlluminateSupportFacadesSchema;
use IlluminateDatabaseSchemaBlueprint;
use IlluminateDatabaseMigrationsMigration;

class CreatePostsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('posts', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('posts');
    }
}

 

2
T.E的Laravel 發表在 留言 (0) 人氣 (1544)
Laravel 學習
分享給朋友
網址

想對外分享這則貼文嗎?運用網址更方便呦~

T.E的Laravel

關於
專門記錄學習Laravel的過程與經歷,與突破困難點時的解決方法,和專家的經驗分享、各種知識點,整個學習Laravel的過程,就是自我提昇能力的過程。
貼文分類
最新貼文
誰來我家
  • 06-05  訪客(40.77.167.*)
  • 06-05  訪客(185.191.171.*)
  • 06-05  訪客(185.191.171.*)
  • 06-05  訪客(44.192.92.*)
OnceHit© 2023
載入中...