We are upgrading our core application and in doing...
# questions
d
We are upgrading our core application and in doing so, are creating a brand new baseline script using the database migration plugin. When we did this, we noticed that all of the previously generated foreign key mappings for related tables are no longer there. Does anyone know if there is a way around this? This would represent an important detail for us to maintain referential integrity. Say when trying to model an individual, a
person
be it a
parent
or
child
should have the same ID using the
tablePerHierarchy=false
mapping. There appears to be an issue raised against this that is quite old dating back to Grails 3.3.3; https://github.com/grails/grails-data-mapping/issues/1076 Does anyone know from any of the contributors or even side bar conversations that I may have missed if the following is expected to be addressed anytime in the not so distant future?
g
Looks like @puneetbehl assigned it to @Guillermo Calvo two days ago according to the github issue you followed up to today, so hopefully movement on it soon. 🙂
🤞 1
g
It worked most of the time for me, but some times I do see some generated change logs did not make any sense. Generally when i saw those, I manually removed them from the change log files, however, it becomes annoying as it consistently re-generated every time I do the gorm diff command. So far, I just eyeballed them and remove those manually. I also appreciated if some one provided some tricks here too.
d
@gaolei Yes, agreed. It's not a show stopper given that you can manually update the changelog but as you said, it becomes a pain continuously pulling out the unwanted changes every time you run the update script. Hopefully we'll hear of something soon from the devs. For the moment, one workaround we are considering is the exclude option that can be exercised in configuration as follows;
Copy code
grails:
    plugin:
        databasemigration:
            excludeObjects: <list of fkeys to keep>
👍 1
g
@drennane can you give me an example, I mostly have issues with compound keys.
d
@gaolei I'm not sure I understand your question. But the issue for me is that foreign keys are not being generated, so we add them. manually, but then everytime the diff script is run, it tries to remove them again. Make sense?
👍 1