2017-02-08 97 views
0

我是laravel的初學者。 我想問爲什麼laraval遷移不在我的數據庫中創建我的表?這是我的.ENV文件:Laravel遷移不會在postgresql數據庫中創建表

APP_ENV=local 
APP_KEY=base64:9FLWfylvrtxjXdunJujBDq37Q4QtKcoiPdmeJbgbLSg= 
APP_DEBUG=true 
APP_LOG_LEVEL=debug 
APP_URL=http://localhost 

DB_CONNECTION=pgsql 
DB_HOST=localhost 
DB_PORT=5432 
DB_DATABASE=laravel5 
DB_USERNAME=postgres 
DB_PASSWORD=1111 

BROADCAST_DRIVER=log 
CACHE_DRIVER=file 
SESSION_DRIVER=file 
QUEUE_DRIVER=sync 

REDIS_HOST=127.0.0.1 
REDIS_PASSWORD=null 
REDIS_PORT=6379 

MAIL_DRIVER=smtp 
MAIL_HOST=mailtrap.io 
MAIL_PORT=2525 
MAIL_USERNAME=null 
MAIL_PASSWORD=null 
MAIL_ENCRYPTION=null 

PUSHER_APP_ID= 
PUSHER_APP_KEY= 
PUSHER_APP_SECRET= 

這是我的遷移文件:

<?php 

use Illuminate\Support\Facades\Schema; 
use Illuminate\Database\Schema\Blueprint; 
use Illuminate\Database\Migrations\Migration; 

class CreateMySongsTable extends Migration 
{ 
    /** 
    * Run the migrations. 
    * 
    * @return void 
    */ 
    public function up() 
    { 
     Schema::create('songs', function (Blueprint $table) { 
      $table->increments('id'); 
      $table->string('title'); 
      $table->string('artist'); 
      $table->timestamps(); 
     }); 
    } 

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

首先 1.run PHP工匠遷移 遷移:2017_02_08_130207_create_articles_table

然後在PostgreSQL可以運行在 newFootball = #\ dt 找不到關係。

請有人幫助我。感謝您的耐心。

回答

0

最後我找到了解決方案。由於運行以下命令所需的.env文件中的更改。

php artisan config:cache 

然後所有的工作都很完美。謝謝。