第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會有你想問的

遷移:無法在laravel中添加外鍵約束

遷移:無法在laravel中添加外鍵約束

小怪獸愛吃肉 2019-12-09 15:32:45
我試圖在Laravel中創(chuàng)建外鍵,但是當(dāng)我使用I遷移表artisan時(shí),拋出以下錯(cuò)誤:[Illuminate\Database\QueryException]SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint (SQL: alter table `priorities` add constraint priorities_user_id_foreign foreign key (`user_id`) references `users` (`id`))     我的遷移代碼是這樣的:優(yōu)先級遷移文件public function up(){    //    Schema::create('priorities', function($table) {        $table->increments('id', true);        $table->integer('user_id');        $table->foreign('user_id')->references('id')->on('users');        $table->string('priority_name');        $table->smallInteger('rank');        $table->text('class');        $table->timestamps('timecreated');    });}/** * Reverse the migrations. * * @return void */public function down(){    //    Schema::drop('priorities');}用戶遷移文件public function up(){    //    Schema::table('users', function($table)    {    $table->create();    $table->increments('id');    $table->string('email');    $table->string('first_name');    $table->string('password');    $table->string('email_code');    $table->string('time_created');    $table->string('ip');    $table->string('confirmed');    $table->string('user_role');    $table->string('salt');    $table->string('last_login');    $table->timestamps();    });}/** * Reverse the migrations. * * @return void */public function down(){    //        Schemea::drop('users');}關(guān)于我做錯(cuò)了什么的任何想法,我想立即得到,因?yàn)槲倚枰獎?chuàng)建很多表,例如用戶,客戶,項(xiàng)目,任務(wù),狀態(tài),優(yōu)先級,類型,團(tuán)隊(duì)。理想我想創(chuàng)建與外鍵,i..e持此數(shù)據(jù)表clients_project和project_tasks等。希望有人可以幫助我入門。
查看完整描述

3 回答

  • 3 回答
  • 0 關(guān)注
  • 655 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號