このエラーメッセージにリレーションが表示されていますが、このエラーを停止するために何が必要なのかわかりません。OcotberCMS - "SQLSTATE [42S22]:列が見つかりません:1054不明な列 'users.application_id'
は、私は、コントローラとコンポーネントを使用したアプリケーションのモデルを持っている。バックエンドでは、私は新しいアプリケーションレコードを追加することができます。しかし、私はエラーを取得し表示する。
"SQLSTATE[42S22]: Column not found: 1054 Unknown column 'users.application_id' in 'where clause' (SQL: select * from `users` where `users`.`deleted_at` is null and `users`.`application_id` = 1 and `users`.`application_id` is not null limit 1)" on line 662 of /srv/users/sssandwich/apps/website/public/vendor/laravel/framework/src/Illuminate/Database/Connection.php
私はこのコードを追加するときに表示されるようにエラーを隔離しましたフィールドの.yamlは Acme \ Models \ Application \ fields.yaml。
0123私は関係は以下/**
* @var array Relations
*/
public $hasOne = [
'client' => ['RainLab\User\Models\User', 'table' => 'users'],
'cv' => ['Acme\Acme\Models\Cv']
];
public $hasMany = [];
public $belongsTo = [
'owner' => ['Backend\Models\User']
];
として設定している
Acme\Models\Application.php
で
は、データベース構造である...
public function up()
{
Schema::create('acme_acme_applications', function(Blueprint $table) {
$table->engine = 'InnoDB';
$table->increments('id');
$table->string('jobs_id')->nullable()->index();
$table->string('application_id')->nullable()->index();
$table->string('owner_id')->nullable()->index();
$table->string('user_id')->nullable()->index();
$table->string('vacancy_id')->nullable()->index();
$table->string('ref_no', 50)->nullable();
$table->char('status_update')->nullable();
$table->timestamps();
});
}
私は 'APPLICATION_ID' をgrep'dしており、 db構造体にのみ現れます。 usersテーブルはRainlab Userプラグインですが、そのテーブルでapplication_idを見つけようとする理由がわかりません。
アプリケーションでhasOneクライアント関係を削除すると、あまりにもドリルダウンしようとしているようです。それ以外の場合はキーを追加してください。 – aynber
ありがとうございます。ただし、hasOneクライアントを削除しても、アプリケーションを送信したユーザーの名前は表示されません。しかし、なぜそれがまだapplication_idを探すのか分かりません。 – ServerSideSkittles
アプリケーションのクライアントをプルしようとしている可能性があります。クライアントにキーを追加してみてください(IDは外部キー、user_idはローカルキーです)。私はフォーマットを認識しないので、どのようにそれらを追加するか分からない。 – aynber