有时候,当我输入:
php artisan
php artisan migrate
etc
我收到消息:
[Illuminate\Database\QueryException]
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'db.ken_permissions' doesn't exist (SQL: select * from `ken_permissions`)
调试,我可以告诉我的问题发生在artisan文件中:
$status = $kernel->handle(
$input = new Symfony\Component\Console\Input\ArgvInput,
new Symfony\Component\Console\Output\ConsoleOutput
);
我已经检查了这个答案,但没有工作:
bootstrap / app.php很干净,
我没有app / start文件夹(L5.1),
routes.php很干净
php artisan -v或php artisan --pretend不起作用,因为工匠在运行之前就失败了。
我唯一拥有的是app / Providers
public function boot(GateContract $gate)
{
parent::registerPolicies($gate);
// Dynamically register permissions with Laravel's Gate.
foreach ($this->getPermissions() as $permission) {
$gate->define($permission->name, function ($user) use ($permission) {
return $user->hasPermission($permission);
});
}
}
一个解决方案是删除我的所有表,然后删除composer dump-autoload,然后再次运行,但它会不断回来。
这是跟踪迁移失败的方法吗? 知道为什么会这样吗?
的Tx!
答案 0 :(得分:3)
转到App \ Provider \ AuthServiceProvider
如果您在启动方法GateContract($ this-> getPermission()等)上使用,请在parent::registerPolicies($gate);
之后移除或添加注释,并完成运行php artisan migrate
答案 1 :(得分:0)
添加观察者的答案here
using System;
using System.Data.OleDb;
using System.Windows.Forms;
using MySql.Data.MySqlClient;
using System.Data;
namespace ImportFile
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
String connection = "SERVER=******;"DATABASE=dbd;"UID=root;"PASSWORD=pws;"Convert Zero Datetime = True";
private void BExport_Click(object sender, EventArgs e)
{
DateTime dat = DateTime.Now;
int time = dat.Hour;
int time1 = dat.Minute;
int time2 = dat.Second;
int month = dat.Month;
int day = dat.Day;
MySqlConnection connection1 = new MySqlConnection(connection);
connection1.Open();
MySqlCommand command = new MySqlCommand ("SELECT * FROM TABLE_Name",connection1);
MySqlDataAdapter dataadpter = new MySqlDataAdapter(command);
DataTable datatable = new DataTable("TABLE_NAME");
dataadpter.Fill(datatable);
datatable.WriteXml("C:\\Users\\Downloads\\agent.xlsx" + time + " - " + time1 + " - " + time2 + " - " + day + " - " + month + "");
MessageBox.Show("export data");
}
}
}
您可以将迁移移至Remove any lines requesting data from your model from these files to be sure artisan is not trying to load data from your non-existent table:
bootstrap/start.php
app/start/global.php
app/start/local.php
app/routes.php
Also be sure to un-register any service providers that utilize data from that table in their register or boot methods inside of app/config/app.php.
并逐个运行迁移
database/temp folder
您将知道哪个迁移导致了问题。
的注意
你也可以使用
php artisan migrate --path=database/temp
获取您要执行的查询。