Reputation: 493
I am about installing Concierge - Laravel 5.x
To use it in a simple car rental booking with manual verfication and confirmation
after installing ,adding providers and publishing vendor
i get this error when i migrate database :
Illuminate\Database\QueryException : SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version f or the right syntax to use near 'after
id
,deleted_at
timestamp null,created_at
timestamp null,updated_a' at line 1 (SQL: create table
services(
idint unsigned not null auto_increment p rimary key,
business_idint unsigned not null,
slugvarchar(255) not null,
namevarchar(255) not null,
durationint unsigned not null default '60',
descriptionvarchar(255) not null,
prere quisitesvarchar(255) null,
colorvarchar(12) null,
type_idint unsigned null after
id,
deleted_attimestamp null,
created_attimestamp null,
updated_at` timestamp null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')
the migration :
Schema::create('services', function (Blueprint $table) {
$table->increments('id');
$table->integer('business_id')->unsigned();
$table->foreign('business_id')->references('id')->on('businesses')->onDelete('cascade');
$table->string('slug');
$table->string('name');
$table->integer('duration')->unsigned()->default(60);
$table->string('description');
$table->string('prerequisites')->nullable();
$table->string('color', 12)->nullable();
$table->integer('type_id')->unsigned()->nullable()->after('id');
$table->foreign('type_id')->references('id')->on('service_types')->onDelete('cascade');
$table->softDeletes();
$table->Timestamps();
$table->unique(['business_id', 'slug']);
});
Upvotes: 0
Views: 2117
Reputation: 26
If you're using vagrant, you mush ssh to your VM and run the commands from there. Otherwise you WILL get permission errors every time.
Upvotes: 0
Reputation: 2835
Problem in after method you calling
after method is for Column Modifiers
Example: when you need to modify the table services then it will work like that. but if you creating the table then its not necessary. you can serialize the attributes as you write it on migration file.
Schema::table('services', function (Blueprint $table) {
$table->integer('type_id')->unsigned()->nullable()->after('id');
});
So in you code its should be like that:
Schema::create('services', function (Blueprint $table) {
$table->increments('id');
$table->integer('type_id')->unsigned()->nullable();
$table->integer('business_id')->unsigned();
$table->foreign('business_id')->references('id')->on('businesses')->onDelete('cascade');
$table->string('slug');
$table->string('name');
$table->integer('duration')->unsigned()->default(60);
$table->string('description');
$table->string('prerequisites')->nullable();
$table->string('color', 12)->nullable();
$table->foreign('type_id')->references('id')->on('service_types')->onDelete('cascade');
$table->softDeletes();
$table->Timestamps();
$table->unique(['business_id', 'slug']);
});
Upvotes: 3