When creating or editing a table in the Voyager database section while enabling the Create migration option.
Then a migration is created and the database changes are done but the migration file is not marked as migrated, and will try to create the table once again if someone runs php artisan migrate.
what is the reason for that?
I guess it is not added to the "migrated" table?
I experienced this issue on a fresh installation of Laravel and Voyager. This was my workflow.
new laravel app
install voyager (no dummy content)
create admin user
log in
create new table via 'Voyager\Create New Table'
entered 'projects' table name
Create model = yes
Create migrations for this table = yes
added one column = "name"
10 Create New Table
Result
I could see a new 'create_projects_table' migrations file is created however the migration didn't run (confirmed via php artisan migration:status)
Also the migration file had 'id' and 'time stamps' but not the 'name' column' that I specified in Voyager\Database.
When I 'described' the table via mysql cli I can see the 'projects' table created by voyager and it only has the one column 'name' and not 'id' or 'created_at & updated_at' as I expected.
When I delete the table created via voyager then the table does get dropped in mysql.
The second time I created a new 'projects' table via Voyager\Database with 'id', 'name', 'created_at', 'updated_at' columns. The migration file was created but didn't run according to migrate:status.
Also, the migration file that voyager created only has 'id' and 'timestamps' columns, it is missing the 'name' column so even if that migration file did run then it would not have created the 'name' column I want in the 'projects' table.
As a work around I was able to delete the 'projects' table via Voyager\Database, create the migration file manually.
Since Voyager only generates a partial migration at the moment, we should simply remove that option, and bring it back when we have full migration generation support.
Note: keep this open as a future reminder.
@abdgad
"php": ">=5.6.4",
"laravel/framework": "5.4.*",
"laravel/tinker": "~1.0",
"tcg/voyager": "^0.11.7"
I'm going to close this due to age. The migration generation feature has been removed and will be re-implemented from scratch.
This issue has been automatically locked since there has not been any recent activity after it was closed. If you have further questions please ask in our Slack group.
Most helpful comment
Since Voyager only generates a partial migration at the moment, we should simply remove that option, and bring it back when we have full migration generation support.