包迁移无效(无错误)

时间:2014-06-25 06:44:39

标签: php mysql laravel-4 composer-php

所以,我创建了一个新的包,其中包含vendor/vendorname/package

中的网站

我已将新软件包添加到我的app/config/app.php文件提供程序数组中:

'Seriousjelly\Portfolio\PortfolioServiceProvider'

我的包composer.json文件似乎是合法的:

"autoload": {
    "classmap": [
        "src/migrations",
        "src/controllers",
        "src/models",
        "src/repositories"
    ],
    "psr-0": {
        "Seriousjelly\\Portfolio\\": "src/"
    }

seriousjelly/porfolio/src/migrations我有2次迁移:

2014_06_25_060429_create_portfolio_categories_table.php:

<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreatePortfolioCategoriesTable extends Migration {

/**
 * Run the migrations.
 *
 * @return void
 */
public function up()
{
    Schema::create('portfolio_categories', function(Blueprint $table){
        $table->increments('id');
        $table->string('title', 255);
        $table->string('subtitle', 255);
        $table->string('short_description', 500);
        $table->string('description');
        $table->string('slug', 60);
        $table->timestamp();
    });

    Schema::create('portfolio_item_categories', function(Blueprint $table) {
        $table->integer('category_id')->unsigned();
        $table->foreign('category_id')->references('id')->on('portfolio_categories');
        $table->integer('item_id')->unsigned();
        $table->foreign('item_id')->references('id')->on('portfolio_items');
    });
}

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

2014_06_25_060414_create_portfolio_items_table.php:

<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreatePortfolioItemsTable extends Migration {

/**
 * Run the migrations.
 *
 * @return void
 */
public function up()
{
    Schema::create('portfolio_items', function(Blueprint $table) {
        $table->increments('id');
        $table->string('title', 255);
        $table->string('subtitle', 255)->nullable;
        $table->string('short_description', 500)->nullable;
        $table->string('description', 500);
        $table->string('slug', 60);
        $table->timestamp();
    });
}

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

现在,当我运行php artisan migrate --package=seriousjelly/portfolio

有人说迁移成功运行,但是,如果我只检查数据库,则只填充迁移表。

如果我再次运行命令,没有任何反应,没有错误,没有消息,没有。

有什么想法吗?

p.s其他包迁移是相同的,似乎运行正常,我尝试过composer update和composer dump-autoload,但这不起作用。

1 个答案:

答案 0 :(得分:0)

啊,好吧,我的坏。似乎我拼写错误,结果是复数:

$table->timestamps();

我不知道为什么终端永远不会犯错误...