grails - Database-migration fails when trying to drop primary keys, but only sometimes -


Very uneven position I have a root change, groovy which is the current output database I have a latest-change Groovy is basically a difference with some minor difference reforms (because the diff is not correct).

Start from the empty database, delete the following tasks ( Scenario 1

  • mysqldump production database
  • dev database in source
  • Delete the latest - Include of changelog.groovy
  • Include the latest-changelog.groovy
  • Perform DBM-Update

    The following does not work ( Scenario 2 ):

    • Drop data database
    • Create empty dev database
    • Performed DBM-Update

      The initial change. Groovy runs without a hitch. But when it goes to the latest-changelog.groovy, it fails with the following:

      < P> cause by: java.sql.SQLException: '/' main_dev / # sql-b4_2334 'error by error.' /_main_dev/book_project_note '(errno: 150)

      A table is defined as such:

        mysql> Desc book_project_note; + ------------------------- - + ------------ + ------ + ------ + --------- + ------- + | Field | Type | Faucet Key | Default | Extra | + --------------------------- + ------------ + ------ + - ---- + --------- + ------- + | Book_project_id | Bilent (20) | No | PRI | Faucet | | Note_id | Bilent (20) | No | PRI | Faucet | | Book_project_note_type_id | Bilent (20) | No | PRI | Faucet | + --------------------------- + ------------ + ------ + - ---- + --------- + ------- +   

      The following changes which fail:

       < Code> ChangeSet (Author: "gdboling (generated)", id: "1341248060406-80") {dropPrimaryKey (name of the tag: "book_project_note")}   

      I'm trying to do here Release the primary key and then recreate 2 of them with the following:

        changeSet (Author: "gdboling (generated)", id: "1341248060406-72") {addPrimaryKey ( ColumnNames: works with "book_project_id,  Scenario 1 , but  fails, I'm thinking that  Scenario 1    

      > Scenario 2 .

      Not sure that this is the real answer to the problem, but I have found out that what is failing is the Book 3FK bookProject_net table is those FK Should be dropped before the dropparents (Duh)

      However, it still does not tell me how this works in landscape 1 but I think addenedigns to some adjacent properties in it. Still trying to research what it really means.

  • Comments