Commit 8203a60f by Vladislav

fix cascade delete

1 parent e1f4255c
......@@ -74,6 +74,7 @@ protected function schedule(Schedule $schedule)
$schedule->command(DictionaryCampaignsSyncByCampaign::class)->everyThirtyMinutes();
$schedule->command(RefreshLimits::class)->hourly();
$schedule->command(DictionariesLoad::class)->saturdays()->at('05:00');
$schedule->command(CampaignsCheckChange::class)->hourlyAt(5);
$schedule->command(CampaignsLoadUpdated::class)->hourlyAt(10);
......@@ -92,7 +93,7 @@ protected function schedule(Schedule $schedule)
$schedule->command(RetargetinglistsUpdate::class)->hourlyAt(10);
$schedule->command(NegativeKeywordSharedSetsLoad::class)->hourlyAt(10);
$schedule->command(AdImagesLoad::class)->hourlyAt(10);
$schedule->command(AdImagesLoad::class)->everyThreeHours();
$schedule->command(CampaignsAdd::class)->hourlyAt(15);
$schedule->command(CampaignsUpdate::class)->hourlyAt(15);
......
......@@ -191,6 +191,7 @@ class TokensController extends Controller
public function destroy(Tokens $token)
{
$token->campaigns()->delete();
$token->delete();
return Redirect::route('tokens')->with('success', 'Token deleted.');
......
......@@ -24,7 +24,8 @@ class CreateLimitsTable extends Migration
$table->boolean('reserved');
$table->timestamps();
$table->foreign('token')->references('id')->on('tokens');
$table->foreign('token')->references('id')->on('tokens')
->cascadeOnDelete();
});
Schema::table('tokens', function (Blueprint $table) {
......
......@@ -62,7 +62,8 @@ class CreateAdGroupsTable extends Migration
$table->timestamps();
$table->foreign('campaign_id')->references('id')->on('campaigns');
$table->foreign('campaign_id')->references('id')->on('campaigns')
->cascadeOnDelete();;
});
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!