Yes, you can absolutely run it even if you have no existing blogs.
The script is safe to run because:
- Empty Check: If the table is empty, it will simply say Migration completed! 0 blogs migrated and exit without doing anything.
- Idempotent: If you add blogs later using the old method (manually via DB) and then run it, it will only migrate those that haven't been converted yet.
- No Duplicate Files: It checks if a .json file path already exists in the content field and skips it if found.
However, if you are starting with a fresh database: You don't need to run this script at all. Since I have updated
blogs.php, any new blogs you create from the admin panel will automatically save their content into JSON files from the start.
You can keep the file as a utility in case you ever need to bulk-import blogs directly into the database in the future.