Reputation: 2400
The relation between the entities must be changed and I'd like to know is it normal to change the association mapping type and whether the data that already exist in db will be transfered normally? I tried to find information about it but didn't found. Or if the mapping will be changed the data that already exists must be transfered manually via sql queries? Thanks
Upvotes: 2
Views: 1885
Reputation: 3641
I could do it simply:
Let A and B be the original tables. A->B (N-1) was moved to A<-AB->B (N-N).
I had to - "remove" the foreignkey column from table A, in favor of records to be inserted into AB (made of the two foreign keys leading to A and B) That's all.
Upvotes: 0
Reputation: 691735
If the association already uses a join table, and the mapping of the many-to-many keeps using the same join table with the same column names, you won't have to do anything except removing the unicity constraint you could have on one of the ci=olumns of the join table.
Otherwise, yes, obviously, you'll have to migrate your schema, using SQL, or any other tool (FlywayDB, Liquibase, etc.).
Upvotes: 1