gpt4 book ai didi

php - 运行插件 :refresh 后未创建数据库表

转载 作者:行者123 更新时间:2023-11-29 02:19:42 24 4
gpt4 key购买 nike

我正在关注 this tutorial创建一个简单的 OctoberCMS 插件。所以我按顺序执行以下命令:

php artisan create:plugin Acme.Demo  
php artisan create:model Acme.Demo Task
php artisan plugin:refresh Acme.Demo

输出:

Rolled back: Acme.Demo  
Reinstalling plugin...
Acme.Demo
- v1.0.1: First version of Demo
- v1.0.2: Create the TODO Tasks table

这是更新文件夹中 create_task_table.php 的内容:

<?php namespace Acme\Demo\Updates;

use Schema;
use October\Rain\Database\Updates\Migration;

class CreateTasksTable extends Migration
{

public function up()
{
Schema::create('acme_demo_tasks', function($table)
{
$table->engine = 'InnoDB';
$table->increments('id');
$table->string('title')->nullable();
$table->timestamps();
});
}

public function down()
{
Schema::dropIfExists('acme_demo_tasks');
}

}

根据教程,在这一步之后我应该可以在数据库中看到acme_demo_tasks表,但是我在那里看不到它,而且好像还没有创建该表。我做错了什么吗?

最佳答案

查看version.yaml中数据库迁移文件的名称,应该是create_tasks_table.php

关于php - 运行插件 :refresh 后未创建数据库表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33880687/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com