This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
Hello,
I read many docs before submiting this post. when I trying to run migration file plugin:refresh I recieving error which not allow me to create foreign keys.
there are no problem on my syntax and etc...
$this->down();
Schema::create('me_texts_full_plots' , function ($table)
{
$table->increments('id');
$table->integer('title_id')->unsigned();
$table->text('content');
$table->boolean('is_published')->default(false);
$table->tinyInteger('status')->unsigned();
});
Schema::create('me_texts_short_plots' , function ($table)
{
$table->increments('id');
$table->integer('title_id')->unsigned();
$table->text('content');
$table->boolean('is_published')->default(false);
$table->tinyInteger('status')->unsigned();
});
Schema::create('me_titles' , function ($table)
{
$table->increments('id');
$table->integer('short_plot_id')->length(10)->unsigned();
$table->integer('full_plot_id')->length(10)->unsigned();
$table->boolean('is_published')->default(false)->index();
$table->tinyInteger('status')->unsigned()->nullable();
$table->softDeletes();
});
Schema::table('me_titles', function ($table)
{
$table->foreign('short_plot_id')->refrences('id')->on('me_texts_short_plots')->onDelete('cascade');
$table->foreign('full_plot_id')->refrences('id')->on('me_texts_full_plots')->onDelete('cascade');
});
any one know what can i do?
Last updated
Try to replace:
$table->integer('short_plot_id')->length(10)->unsigned(); $table->integer('full_plot_id')->length(10)->unsigned();
with:
$table->integer('short_plot_id')->unsigned(); $table->integer('full_plot_id')->unsigned();
Why there is $this->down();
in top of your code, btw?
Last updated
Thanks raw,
it because some times I received error of table exist when used plugin:refresh command.
I test this way and not work :(
webmaster said:
Thanks raw,
it because some times I received error of table exist when used plugin:refresh command.
I test this way and not work :(
Ok, I have done same mistake as you. You forgot about $table->engine = 'InnoDB';
for table "me_titles"... :)
Last updated
1-5 of 5