DEV Community

Cover image for sudo su remove `personal_access_tokens`
Simon Benjámin
Simon Benjámin

Posted on

sudo su remove `personal_access_tokens`

Legacy projekt Laravelesítése

Legacy projekt Laravelesítése (Laravel 8 - mert a PHP verzió adott ahhoz igazodunk) közben futottam bele abba, hogy az üres adatbázis séma létrehozásakor:

php artisan schema:dump
php artisan migrate:refresh
Enter fullscreen mode Exit fullscreen mode

mindenképpen létrejött a personal_access_tokens tábla és a migrációs file:

Nothing to rollback.
Loading stored database schema: /var/www/html/database/schema/mysql-schema.dump
Loaded stored database schema. (49,714.31ms)
Migrating: 2019_12_14_000001_create_personal_access_tokens_table
Migrated:  2019_12_14_000001_create_personal_access_tokens_table (2,930.78ms)
Enter fullscreen mode Exit fullscreen mode

A Laracast fórumában 2 megoldást is találtam a probléma megszüntetésére:

1. laravel/sanctum csomag eltávolítása

Valamiért a Laravelben alapból mellékelve van a fenti csomag, egyszerűen távolítsuk el (ha kell droppoljuk a token táblát) és utána a séma frissítésekor nem fog létrejönni a migrációs file:

composer remove laravel/sanctum
Enter fullscreen mode Exit fullscreen mode

2. Ignoráljuk a migrációját

Az AppServiceProvider.php fájlban a register() függvényben hívjuk meg az alábbi parancsot (a fájl elejére a use Laravel\Sanctum\Sanctum;-ot is tegyük oda):

# app/Providers/AppServiceProvider.php

public function register()
{
    // sudo su ne jojjon letre a `personal_access_tokens` migrations
    Sanctum::ignoreMigrations();
}
Enter fullscreen mode Exit fullscreen mode

Mindkettő működik, én a második megoldást választottam. Így talán jobban szem előtt van, miért és hogyan lett "inaktiválva". (A kódban taktikai komment elhelyezésével ha valaki rákeres meg is találja a megfelelő kódrészletet.)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Engage with a sea of insights in this enlightening article, highly esteemed within the encouraging DEV Community. Programmers of every skill level are invited to participate and enrich our shared knowledge.

A simple "thank you" can uplift someone's spirits. Express your appreciation in the comments section!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found this useful? A brief thank you to the author can mean a lot.

Okay