Giter Site home page Giter Site logo

Comments (6)

jameskleeh avatar jameskleeh commented on June 15, 2024 1

I verified the index diff is now created correctly:

databaseChangeLog = {

    changeSet(author: "jameskleeh (generated)", id: "1477666371113-1") {
        createIndex(indexName: "apitoken_Idx", tableName: "person") {
            column(name: "api_token")

            column(name: "device_id")
        }
    }
}

from grails-database-migration.

robertoschwald avatar robertoschwald commented on June 15, 2024

Sample application see https://github.com/robertoschwald/grails-database-migration-issue74-example

from grails-database-migration.

robertoschwald avatar robertoschwald commented on June 15, 2024

When using Grails 2.4.4 with dbm plugin 1.4.0 using the same sample domain class as stated above, the indexes are created correctly:

databaseChangeLog = {
    changeSet(author: "roos (generated)", id: "1465201783236-1") {
        createTable(tableName: "api_access_token") {
            column(autoIncrement: "true", name: "id", type: "bigint") {
                constraints(nullable: "false", primaryKey: "true", primaryKeyName: "api_access_toPK")
            }

            column(name: "version", type: "bigint") {
                constraints(nullable: "false")
            }

            column(name: "api_token", type: "varchar(255)") {
                constraints(nullable: "false")
            }

            column(name: "device_id", type: "varchar(255)") {
                constraints(nullable: "false")
            }
        }
    }

    changeSet(author: "roos (generated)", id: "1465201783236-2") {
        createIndex(indexName: "apitoken_Idx", tableName: "api_access_token") {
            column(name: "api_token")
            column(name: "device_id")
        }
    }

    changeSet(author: "roos (generated)", id: "1465201783236-3") {
        createIndex(indexName: "unique_api_token", tableName: "api_access_token", unique: "true") {
            column(name: "device_id")
            column(name: "api_token")
        }
    }
}

from grails-database-migration.

robertoschwald avatar robertoschwald commented on June 15, 2024

Liquibase seems to detect the apitoken_Idx index correctly. diffResult in GroovyDiffToChangeLogCommand contains the index, but the serializer does not seem to generate the changelog entry:

INFO liquibase-hibernate - Found table api_access_token
INFO liquibase-hibernate - Found unique constraint null on api_access_token(device_id, api_token)
WARN liquibase-hibernate - Hibernate primary key name is probably truncated. api_access_toPK
WARN liquibase-hibernate - Changing hibernate primary key name to api_access_tokenPK
INFO liquibase-hibernate - Found primary key api_access_tokenPK
INFO liquibase-hibernate - Found index apitoken_Idx
INFO liquibase-hibernate - Found column id bigint
INFO liquibase-hibernate - Found column version bigint
INFO liquibase-hibernate - Found column api_token varchar(255)
INFO liquibase-hibernate - Found column device_id varchar(255)
INFO liquibase-hibernate - Found index apitoken_Idx

So seems to be a Liquibase 3.5 problem. See liquibase/liquibase-hibernate#100

from grails-database-migration.

robertoschwald avatar robertoschwald commented on June 15, 2024

As stated in the liquibase issue I referenced, HibernateDatabase is blacklisted in some migration types of newer Liquibase versions. Therefore, normal indexes are currently not supported when using plugin version 2.0.0.x. I contacted the Liquibase author.

from grails-database-migration.

jameskleeh avatar jameskleeh commented on June 15, 2024

@robertoschwald This should be fixed in version 3.0.0.BUILD-SNAPSHOT of the plugin that supports hibernate 5. Can you confirm that?

from grails-database-migration.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.