You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This should generate a json of data that is needed when deleting the foreign key.
Those json files will be saved in directory database/foreign_keys/ and the json filename would be the migration_file_name.json.
So when we run the above migration it will create a file database/foreign_keys/20180101_create_posts_table.json. One json file per migration file. Only 20180101_create_posts_table.json is created because it is the only migration file that calls Fk::make().
The data needed to drop a foreign key is the:
table
foreign key name.
Sample Dropping of foreign key :
Schema::table('posts', function ($table) {
$table->dropForeignKey('the_foreign_key_name');
});
For example we are developing a blog app. The tables involved are
users
,tags
andposts
tables.Migration Files:
20180101_create_users_table
20180101_create_tags_table
20180101_create_posts_table
This should generate a json of data that is needed when deleting the foreign key.
Those json files will be saved in directory
database/foreign_keys/
and the json filename would be themigration_file_name.json
.So when we run the above migration it will create a file
database/foreign_keys/20180101_create_posts_table.json
. One json file per migration file. Only20180101_create_posts_table.json
is created because it is the only migration file that callsFk::make()
.The data needed to drop a foreign key is the:
Sample Dropping of foreign key :
Sample json file format:
It is an array of objects, because it can be possible that one migration file can involve many tables.
The code will be placed in the
Fk::migrate()
method.The text was updated successfully, but these errors were encountered: