Quantcast
Channel: Liquibase Forums
Viewing all articles
Browse latest Browse all 2993

Replacing a table with a table from a different application

$
0
0
I have a Java application that initializes a database with the following schema

Now I would like to replace the users table in that database with a users table created by a different application:

And now I'm pondering how do accomplish this:
  1. Remove the users table from the original changeset (the changeset setting up the schema for the ukelonn application)?
  • This will work for setting up a brand new ukelonn database
  • This will fail for existing ukelonn databases, because the changeset's checksum doesn't match the one in the changelog of the database
  • Have a conditional remove-if-exists for the users table (like I already have added to the start of the authservice changelog file)?
    • This works for existing ukelonn databases
    • This works for new ukelonn databases if the ukelonn changeset is run first (and I don't think I can arrange that)
    • This fails in a new database if the authservice database liquibase runs before the ukelonn database, because then ukelonn schema creation changeset will break because a users table already exists in the database (and making the users table creation conditional will change the changeset checksum and break existing ukelonn databases in the same way removing the table will)
    Thoughts?

    Lessons learned: 
    • don't make the initial schema creation a single big changeset
    • make all table creations conditional
    (Or maybe that's too much work for the rare edge case of replacing a table with a table belonging to a different application.... and in any case it's too late for this particular application...:-) )
     

    Viewing all articles
    Browse latest Browse all 2993

    Trending Articles



    <script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>