Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions docs/docs/upgrade-guide.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,19 @@ Compare the installed package's `config/feeds.php` with the application's publis

[PR #287](https://github.com/TheDragonCode/laravel-feeds/pull/287) changes single-feed selection from a database ID to a slug derived with `Str::slug(title)`.

If the package's slug migration has already run, do not copy or run it again. Otherwise:
If the package's slug migration has not run yet, publish the migrations:

1. Copy only `vendor/dragon-code/laravel-feeds/database/migrations/2026_10_14_000000_add_slug_to_feeds_table.php` into the application's `database/migrations` directory.
2. Set its filename timestamp immediately after the application's actual `create_feeds_table` migration and before any feed-registration migrations. Keep the `add_slug_to_feeds_table` suffix. This order also lets a fresh database create registrations after the slug column exists.
3. Confirm that `feeds.table.connection` and `feeds.table.table` point to the existing registration table, then run migrations:
```bash
php artisan vendor:publish --tag=feeds-migrations

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Publish only the ordered slug migration

For applications upgrading from 1.x with the original table migration and generated feed-registration migrations, this command publishes both package migrations because LaravelFeedServiceProvider::migrations() maps the entire directory. Laravel 13 then replaces their timestamps with the publication time: unless the user identifies and removes the new create-table copy, migrate tries to create the existing table, and even after removing it the slug migration sorts after older registration migrations, so migrate:fresh runs registrations that write slug before that column exists. Restore the selective slug-file copy and explicitly place its timestamp after create_feeds_table but before feed-registration migrations.

Useful? React with 👍 / 👎.

```

The command publishes all migration files. Validate the published files and delete any unnecessary ones, then run the migrations:

```bash
php artisan migrate
```

The migration adds a nullable `slug` column and fills it from existing titles, including soft-deleted records. Existing titles and IDs are preserved. Do not republish or rerun the original create-table migration.
The migration adds a nullable `slug` column and fills it from existing titles, including soft-deleted records. Existing titles and IDs are preserved.

:::warning
If the application already owns a `slug` column and the package migration has not run, the migration fails before backfilling any data. Resolve that schema conflict before deployment; do not drop an application-owned column without preserving its data and updating its callers.
Expand All @@ -73,7 +75,7 @@ Saving a feed model recalculates its slug from the stored title. Query Builder b

## Replace IDs in generation calls {/* #generation-calls */}

For registration ID `42` with stored title `Products Feed`, the migrated slug is `products-feed`.
For registration ID `42` with stored title `Products`, the migrated slug is `products`.

Before:

Expand All @@ -84,13 +86,13 @@ php artisan feed:generate 42
After:

```bash
php artisan feed:generate products-feed
php artisan feed:generate products
```

The argument is always a slug in `2.x`; a numeric string no longer selects a database ID. Calling `php artisan feed:generate` without an argument still processes all active registrations. With `--target`, replace only the registration argument; target keys stay the same:

```bash
php artisan feed:generate products-feed --target=42
php artisan feed:generate products --target=42
```

Update manual schedules and programmatic command calls in the same way. Before:
Expand All @@ -108,7 +110,7 @@ After:
use DragonCode\LaravelFeed\Commands\FeedGenerateCommand;
use Illuminate\Support\Facades\Schedule;

Schedule::command(FeedGenerateCommand::class, ['products-feed'])->daily();
Schedule::command(FeedGenerateCommand::class, ['products'])->daily();
```

Keep the manual schedule's existing overlap, background, and frequency settings. Update hardcoded slugs when renaming registrations. `ScheduleFeedHelper::register()` uses stored slugs automatically and keeps overlap locks tied to the registration when its title or cron expression changes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,19 @@ composer check-platform-reqs

[PR #287](https://github.com/TheDragonCode/laravel-feeds/pull/287) змяняе выбар адной стужкі: замест ідэнтыфікатара базы даных выкарыстоўваецца slug, атрыманы праз `Str::slug(title)`.

Калі міграцыя slug пакета ўжо выканана, не капіруйце і не запускайце яе паўторна. Інакш:
Калі міграцыя slug пакета яшчэ не выканана, апублікуйце міграцыі:

1. Скапіруйце толькі `vendor/dragon-code/laravel-feeds/database/migrations/2026_10_14_000000_add_slug_to_feeds_table.php` у каталог `database/migrations` праграмы.
2. Задайце timestamp імя файла адразу пасля фактычнай міграцыі `create_feeds_table` праграмы і перад усімі міграцыямі рэгістрацыі стужак. Захавайце суфікс `add_slug_to_feeds_table`. Такі парадак таксама дазваляе новай базе даных ствараць рэгістрацыі пасля дадання слупка slug.
3. Пераканайцеся, што `feeds.table.connection` і `feeds.table.table` паказваюць на існуючую табліцу рэгістрацый, затым выканайце міграцыі:
```bash
php artisan vendor:publish --tag=feeds-migrations
```

Каманда публікуе ўсе файлы міграцый. Праверце апублікаваныя файлы і выдаліце непатрэбныя, затым выканайце міграцыі:

```bash
php artisan migrate
```

Міграцыя дадае слупок `slug`, які дазваляе NULL, і запаўняе яго з існуючых назваў, уключаючы мякка выдаленыя запісы. Існуючыя назвы і ідэнтыфікатары захоўваюцца. Не публікуйце паўторна і не запускайце зыходную міграцыю стварэння табліцы.
Міграцыя дадае слупок `slug`, які дазваляе NULL, і запаўняе яго з існуючых назваў, уключаючы мякка выдаленыя запісы. Існуючыя назвы і ідэнтыфікатары захоўваюцца.

:::warning
Калі праграма ўжо мае ўласны слупок `slug`, а міграцыя пакета яшчэ не выканана, міграцыя завершыцца памылкай перад запаўненнем даных. Вырашыце канфлікт схемы да разгортвання; не выдаляйце слупок праграмы без захавання яго даных і абнаўлення кода, які яго выкарыстоўвае.
Expand All @@ -73,7 +75,7 @@ Slug для выбару стужак павінны быць непустымі

## Замена ID ў выкліках генерацыі {/* #generation-calls */}

Для рэгістрацыі з ID `42` і захаванай назвай `Products Feed` slug пасля міграцыі будзе `products-feed`.
Для рэгістрацыі з ID `42` і захаванай назвай `Products` slug пасля міграцыі будзе `products`.

Да:

Expand All @@ -84,13 +86,13 @@ php artisan feed:generate 42
Пасля:

```bash
php artisan feed:generate products-feed
php artisan feed:generate products
```

У `2.x` аргумент заўсёды азначае slug; лікавы радок больш не выбірае запіс па ID базы даных. Выклік `php artisan feed:generate` без аргумента па-ранейшаму апрацоўвае ўсе актыўныя рэгістрацыі. Пры выкарыстанні `--target` замяніце толькі аргумент рэгістрацыі; ключы мэтаў застаюцца ранейшымі:

```bash
php artisan feed:generate products-feed --target=42
php artisan feed:generate products --target=42
```

Таксама абнавіце ручныя расклады і праграмныя выклікі каманды. Да:
Expand All @@ -108,7 +110,7 @@ Schedule::command(FeedGenerateCommand::class, [42])->daily();
use DragonCode\LaravelFeed\Commands\FeedGenerateCommand;
use Illuminate\Support\Facades\Schedule;

Schedule::command(FeedGenerateCommand::class, ['products-feed'])->daily();
Schedule::command(FeedGenerateCommand::class, ['products'])->daily();
```

Захавайце налады абароны ад адначасовага запуску, фонавага выканання і частаты ручнога раскладу. Пры перайменаванні рэгістрацый абнаўляйце slug, пазначаныя ў кодзе. `ScheduleFeedHelper::register()` аўтаматычна выкарыстоўвае захаваныя slug і захоўвае прывязку блакіровак да рэгістрацыі пры змене яе назвы або выразу cron.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,19 @@ Vergleichen Sie `config/feeds.php` des installierten Pakets mit der veröffentli

[PR #287](https://github.com/TheDragonCode/laravel-feeds/pull/287) ändert die Auswahl einzelner Feeds von einer Datenbank-ID zu einem mit `Str::slug(title)` erzeugten Slug.

Wenn die Slug-Migration des Pakets bereits ausgeführt wurde, kopieren Sie sie nicht erneut und führen Sie sie nicht erneut aus. Andernfalls:
Wenn die Slug-Migration des Pakets noch nicht ausgeführt wurde, veröffentlichen Sie die Migrationen:

1. Kopieren Sie nur `vendor/dragon-code/laravel-feeds/database/migrations/2026_10_14_000000_add_slug_to_feeds_table.php` in das Verzeichnis `database/migrations` der Anwendung.
2. Setzen Sie den Zeitstempel im Dateinamen unmittelbar nach der tatsächlichen `create_feeds_table`-Migration der Anwendung und vor allen Migrationen zur Feed-Registrierung. Behalten Sie das Suffix `add_slug_to_feeds_table` bei. Diese Reihenfolge ermöglicht es auch einer neuen Datenbank, Registrierungen erst anzulegen, nachdem die Slug-Spalte vorhanden ist.
3. Prüfen Sie, ob `feeds.table.connection` und `feeds.table.table` auf die bestehende Registrierungstabelle verweisen, und führen Sie dann die Migrationen aus:
```bash
php artisan vendor:publish --tag=feeds-migrations
```

Der Befehl veröffentlicht alle Migrationsdateien. Prüfen Sie die veröffentlichten Dateien und löschen Sie nicht benötigte Dateien. Führen Sie anschließend die Migrationen aus:

```bash
php artisan migrate
```

Die Migration fügt eine Spalte `slug` hinzu, die NULL-Werte zulässt, und füllt sie aus bestehenden Titeln, einschließlich vorläufig gelöschter Datensätze. Bestehende Titel und IDs bleiben erhalten. Veröffentlichen Sie die ursprüngliche Migration zum Erstellen der Tabelle nicht erneut und führen Sie sie nicht erneut aus.
Die Migration fügt eine Spalte `slug` hinzu, die NULL-Werte zulässt, und füllt sie aus bestehenden Titeln, einschließlich vorläufig gelöschter Datensätze. Bestehende Titel und IDs bleiben erhalten.

:::warning
Wenn die Anwendung bereits eine eigene Spalte `slug` besitzt und die Paketmigration noch nicht ausgeführt wurde, schlägt die Migration fehl, bevor Daten nachgetragen werden. Lösen Sie diesen Schemakonflikt vor dem Deployment; löschen Sie keine anwendungseigene Spalte, ohne ihre Daten zu sichern und ihre Aufrufer zu aktualisieren.
Expand All @@ -73,7 +75,7 @@ Beim Speichern eines Feed-Modells wird sein Slug aus dem gespeicherten Titel neu

## IDs in Generierungsaufrufen ersetzen {/* #generation-calls */}

Für die Registrierungs-ID `42` mit dem gespeicherten Titel `Products Feed` lautet der migrierte Slug `products-feed`.
Für die Registrierungs-ID `42` mit dem gespeicherten Titel `Products` lautet der migrierte Slug `products`.

Vorher:

Expand All @@ -84,13 +86,13 @@ php artisan feed:generate 42
Nachher:

```bash
php artisan feed:generate products-feed
php artisan feed:generate products
```

In `2.x` ist das Argument immer ein Slug; eine numerische Zeichenfolge wählt keine Datenbank-ID mehr aus. Der Aufruf von `php artisan feed:generate` ohne Argument verarbeitet weiterhin alle aktiven Registrierungen. Ersetzen Sie bei `--target` nur das Registrierungsargument; die Zielschlüssel bleiben gleich:

```bash
php artisan feed:generate products-feed --target=42
php artisan feed:generate products --target=42
```

Aktualisieren Sie manuelle Zeitpläne und programmatische Befehlsaufrufe auf dieselbe Weise. Vorher:
Expand All @@ -108,7 +110,7 @@ Nachher:
use DragonCode\LaravelFeed\Commands\FeedGenerateCommand;
use Illuminate\Support\Facades\Schedule;

Schedule::command(FeedGenerateCommand::class, ['products-feed'])->daily();
Schedule::command(FeedGenerateCommand::class, ['products'])->daily();
```

Behalten Sie bei manuellen Zeitplänen die bestehenden Einstellungen für Überschneidungen, Hintergrundausführung und Häufigkeit bei. Aktualisieren Sie fest eingetragene Slugs, wenn Sie Registrierungen umbenennen. `ScheduleFeedHelper::register()` verwendet gespeicherte Slugs automatisch und hält Überschneidungssperren an die Registrierung gebunden, wenn sich ihr Titel oder Cron-Ausdruck ändert.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,19 @@ Comparez le fichier `config/feeds.php` du paquet installé à la copie publiée

La [PR #287](https://github.com/TheDragonCode/laravel-feeds/pull/287) remplace la sélection d’un flux par son identifiant en base de données par une sélection par slug, dérivé avec `Str::slug(title)`.

Si la migration des slugs du paquet a déjà été exécutée, ne la copiez pas et ne l’exécutez pas à nouveau. Sinon :
Si la migration des slugs du paquet n’a pas encore été exécutée, publiez les migrations :

1. Copiez uniquement `vendor/dragon-code/laravel-feeds/database/migrations/2026_10_14_000000_add_slug_to_feeds_table.php` dans le répertoire `database/migrations` de l’application.
2. Placez l’horodatage de son nom de fichier immédiatement après celui de la migration `create_feeds_table` réellement présente dans l’application et avant toute migration d’enregistrement de flux. Conservez le suffixe `add_slug_to_feeds_table`. Cet ordre permet aussi à une nouvelle base de données de créer les enregistrements une fois la colonne slug ajoutée.
3. Vérifiez que `feeds.table.connection` et `feeds.table.table` désignent la table d’enregistrement existante, puis exécutez les migrations :
```bash
php artisan vendor:publish --tag=feeds-migrations
```

La commande publie tous les fichiers de migration. Validez les fichiers publiés et supprimez ceux qui sont inutiles, puis exécutez les migrations :

```bash
php artisan migrate
```

La migration ajoute une colonne `slug` qui accepte les valeurs NULL et la remplit à partir des titres existants, y compris ceux des enregistrements supprimés temporairement. Les titres et identifiants existants sont conservés. Ne republiez pas et ne réexécutez pas la migration d’origine qui crée la table.
La migration ajoute une colonne `slug` qui accepte les valeurs NULL et la remplit à partir des titres existants, y compris ceux des enregistrements supprimés temporairement. Les titres et identifiants existants sont conservés.

:::warning
Si l’application possède déjà sa propre colonne `slug` et que la migration du paquet n’a pas été exécutée, la migration échoue avant de remplir les données. Résolvez ce conflit de schéma avant le déploiement ; ne supprimez pas une colonne propre à l’application sans conserver ses données et mettre à jour le code qui l’utilise.
Expand All @@ -73,7 +75,7 @@ L’enregistrement d’un modèle de flux recalcule son slug à partir du titre

## Remplacer les identifiants dans les appels de génération {/* #generation-calls */}

Pour l’enregistrement d’identifiant `42` dont le titre stocké est `Products Feed`, le slug après migration est `products-feed`.
Pour l’enregistrement d’identifiant `42` dont le titre stocké est `Products`, le slug après migration est `products`.

Avant :

Expand All @@ -84,13 +86,13 @@ php artisan feed:generate 42
Après :

```bash
php artisan feed:generate products-feed
php artisan feed:generate products
```

Dans `2.x`, l’argument est toujours un slug ; une chaîne numérique ne sélectionne plus un identifiant en base de données. L’appel à `php artisan feed:generate` sans argument traite toujours tous les enregistrements actifs. Avec `--target`, remplacez uniquement l’argument d’enregistrement ; les clés des cibles restent identiques :

```bash
php artisan feed:generate products-feed --target=42
php artisan feed:generate products --target=42
```

Mettez à jour les planifications manuelles et les appels de commandes dans le code de la même manière. Avant :
Expand All @@ -108,7 +110,7 @@ Après :
use DragonCode\LaravelFeed\Commands\FeedGenerateCommand;
use Illuminate\Support\Facades\Schedule;

Schedule::command(FeedGenerateCommand::class, ['products-feed'])->daily();
Schedule::command(FeedGenerateCommand::class, ['products'])->daily();
```

Conservez les paramètres existants des planifications manuelles pour les chevauchements, l’exécution en arrière-plan et la fréquence. Mettez à jour les slugs écrits en dur lorsque vous renommez des enregistrements. `ScheduleFeedHelper::register()` utilise automatiquement les slugs stockés et maintient les verrous de chevauchement liés à l’enregistrement lorsque son titre ou son expression cron change.
Expand Down
Loading
Loading