php - 包迁移不起作用(没有错误)

标签 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 但这不起作用。

最佳答案

啊,好吧,我的错。看来我拼写错误,原来是复数:

$table->timestamps();

我不确定为什么终端从未抛出错误......

关于php - 包迁移不起作用(没有错误),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24401893/

相关文章:

php - 如何使用通过 jQuery 的 AJAX 发布请求 + php 发送的数组?

php - laravel 插入多个输入

PHP MySql 一次插入 n 行?

mysql - 拉拉维尔 4.2 : Eloquent is creating insert queries with NULL values

php - HTML 电子邮件中的感叹号

javascript -\n 在 Javascript 中破坏 PHP 代码

mysql - 单个查询 : Getting ratings from 12 months, 但计数所有

php - 我无法将 drupal 迁移到本地服务器

php - Laravel Eloquent 加入

php - 无法执行 Laravel artisan 命令