ฉันมีการโยกย้ายที่สร้างตารางอย่างถูกต้องที่เซิร์ฟเวอร์คนจรจัดในเครื่อง แต่เมื่อฉันพยายามย้ายที่ VPS ด้วย nginx ก็พบข้อผิดพลาดแปลก ๆ
env ในเครื่องคือ Vagrant/homestead (ฉันไม่รู้ OS ขออภัย), VPS env คือ Debian 8, nginx Laravel เวอร์ชัน 5.3 การย้ายข้อมูลต้องสร้าง 12 ตาราง แต่พบปัญหาก่อนสิ้นสุดกระบวนการ ดังนั้นจึงสร้างเพียง 10 ตารางเท่านั้น โดยวิธีการแสดงให้เห็นว่า env และการตั้งค่าอื่น ๆ ก็โอเค (ฉันคิดว่า) และเพียงในฟิลด์ 1 ตาราง 1 ก็มีข้อผิดพลาด
นี่คือรหัสการสร้าง:
public function up()
{
Schema::create('vicards', function (Blueprint $table) {
$table->increments('id');
$table->string('visi_slug', 100);
$table->unique('visi_slug', 'visi_slug_unique');
$table->integer('user_id');
$table->index('user_id', 'cards_user_id_index');
$table->string('user_slug', 100);
$table->index('user_slug', 'cards_user_slug_index');
$table->string('avatar', 44)->default(0);
$table->string('header', 80);
$table->string('price', 12);
$table->text('description');
$table->text('pictures'); // 5 pics * 20 symbols + 4 commas
$table->text('videos'); // 3 videos * 41 symbols + 2 commas
$table->text('contacts'); //
$table->text('links'); // links separated by commas
$table->text('styles'); // object serialized
$table->tinyInteger('actual', 1)->default(0);
$table->timestamps();
});
}
ปัญหาเรียกใช้ฟิลด์นี้
$table->tinyInteger('actual', 1)->default(0);
ช่างตีความได้ใน:
`actual` tinyint not null default '0' auto_increment primary key
และนอกหลักสูตรเป็นข้อผิดพลาดเนื่องจากมี 'คีย์หลัก auto_increation' อยู่แล้ว - ฟิลด์ที่ 1
ผลลัพธ์ที่คาดหวัง - การสร้างตารางปกติ
ฉันได้รับข้อผิดพลาด:
" [Illuminate\Database\QueryException] SQLSTATE[42000]: ข้อผิดพลาดทางไวยากรณ์หรือการละเมิดการเข้าถึง: 1067 ค่าเริ่มต้นไม่ถูกต้องสำหรับ 'จริง' (SQL: สร้างตาราง vicards
(id
int unsigned ไม่ใช่ null auto_increation คีย์หลัก, visi_slug
varchar(100) ไม่ใช่ null , user_id
int ไม่ใช่ null, user_slug
varchar(100) ไม่ใช่ null, avatar
varchar (44) ไม่ใช่ null ค่าเริ่มต้น '0', header
varchar(80) ไม่ใช่ null, price
varchar(12) ไม่ใช่ null, description
ข้อความไม่ใช่ null, pictures
ข้อความไม่ใช่ null, videos
ข้อความไม่เป็น null, contacts
ข้อความไม่เป็น null, links
ข้อความไม่เป็น null, styles
ข้อความไม่เป็น null, actual
Tinyint ไม่ใช่ null ค่าเริ่มต้น '0' auto_inc rement คีย์หลัก, created_at
การประทับเวลา null, updated_at
การประทับเวลา null) ชุดอักขระเริ่มต้น utf8 เปรียบเทียบ utf8_unicode_ci) "
อะไรคือสาเหตุของข้อผิดพลาดนี้? โปรดช่วยฉันด้วย