관계와 함께이 오류 메시지가 표시되지만이 오류를 중지하기 위해 수행해야 할 작업을 찾을 수 없습니다 ..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.
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();
});
}
내가 grep'd 한 'APPLICATION_ID'와 ...
/**
* @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']
];
다음
데이터베이스 구조이기 때문에 설정 한 관계를 가지고 db 구조에서만 나타납니다. users 테이블은 Rainlab User 플러그인이지만 왜 그 테이블에서 application_id를 찾으려고하는지 확신 할 수 없습니다.
응용 프로그램에서 hasOne 클라이언트 관계를 제거하면 너무 많이 드릴 다운하는 것처럼 보입니다. 그렇지 않으면 대신 키를 추가하십시오. – aynber
감사합니다.하지만 hasOne 클라이언트를 제거하면 응용 프로그램을 제출 한 사용자의 이름이 표시되지 않습니다. 하지만 왜 아직도 application_id를 찾지 못했습니다. – ServerSideSkittles
응용 프로그램의 클라이언트를 가져 오는 중일 수 있습니다. 클라이언트에 키를 추가하십시오 (외부 키는 id, 로컬 키는 user_id). 형식을 인식하지 못하기 때문에 추가 할 방법을 모르겠습니다. – aynber