douling8087 2014-08-09 19:16
浏览 195

Laravel迁移和PostgreSQL模式

I'm using PostgreSQL and want to try Laravel.

First - my up() function:

public function up()
{
    Schema::create('entries.entries', function($t) {

        $t->increments('id');
        $t->string('username', 50);
        $t->string('email', 100);
        $t->text('comment');
        $t->timestamps();
    });
}

And i have two questions:

1) I haven't shema entries in my database, so, how can i change my up function to create it too? I dont want to do it manually.

2) I got an error when executed migration:

 sudo php artisan migrate

 [Illuminate\Database\QueryException]                                         
     SQLSTATE[3F000]: Invalid schema name: 7 ERROR:  no schema has been selected  
     to create in (SQL: create table "emigrations" ("migration" varchar(255) not null,
     "batch" integer not null))       

How can i fix it?

  • 写回答

2条回答 默认 最新

  • doubinei1457 2014-08-14 14:36
    关注

    1) I don't think there is such functionality in Laravel but you can use an external package like https://github.com/pacuna/Laravel-PGSchema

    2) Did you remove the default schema in your app/config/database.php file?

    'pgsql' => array(
                'driver'   => 'pgsql',
                'host'     => 'localhost',
                'database' => 'forge',
                'username' => 'forge',
                'password' => '',
                'charset'  => 'utf8',
                'prefix'   => '',
                'schema'   => 'public',
            ),
    
    评论

报告相同问题?

悬赏问题

  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100