0 votes

Possibly an edge case, but I am working on a large-scale migration where we need to keep a legacy database running whilst upgrading parts of it in phases to Laravel. Both databases will reside on the same server during this development.

We have been migrating a selection of tables at a time, and in one case we are looking at generating a temporary relationship between a table in the new database and a table in the legacy database.

See the 2 many-to-many relationships coming from Organisation below.

erd

For LegacyUserHasOrganisation, I want the relationship definitions on the model, but I want to avoid physically setting the foreign keys on the legacy database.

I'm able to manually simulate this behaviour by commenting out the foreign key generation in the migration file, e.g.

// Schema::table('legacy_user_has_organisation', function (Blueprint $table) {
//     $table->foreign('organisation_id')->references('id')->on('organisations');
//     $table->foreign('user_id')->references('User_Id')->on('users');
// });

Does functionality like this already exist in Skipper, or can it be added in a future release?

in Feature Request by (120 points)

1 Answer

0 votes

Hello,

unfortunately, it's not possible to disable exporting of one association. This would lead to several inconsistencies and it would be very complicated to implement it (a lot of unnecessary IFs which could bring new errors).

But, you can split your modifications into two revisions and disable the export of the specified revision. In the first step, create tables and everything you need to be exported, in the second step, create the association. Then, in the migration manager, select the second revision and disable this revision for the export.

by Skipper developer (138k points)