开发者

DB column order creation in Grails

开发者 https://www.devze.com 2023-01-08 00:11 出处:网络
I have this domain class: class Requestmap { String url String configAttribute static constraints = { url(blank: false, unique: true)

I have this domain class:

class Requestmap {

    String url
    String configAttribute

    static constraints = {
        url(blank: false, unique: true)
    configAttribute(blank: false)
    }
}

Its DB Table corresponds to

      Column      |          Type          | Modifiers 
------------------+------------------------+-----------
 id               | bigint                 | not null
 version          | bigint                 | not null
 config_attribute | character varying(255) | not null
 url              | character varying(255) | not null
Indexes:
    "requestmap_pkey" PRIMARY KEY, btree (id)
    "requestmap_url_key" UNIQUE, btree (url)

The question is: 开发者_StackOverflow中文版Is there a way for GORM to force the column creation order in the table ? I need url to be the third column and config_attribute the fourth (DB restore reasons).

Thanks


At least a workaround: use 'grails schema-export' to generate a DDL file (target/ddl.sql), modify that manually and apply it to the DB.

0

精彩评论

暂无评论...
验证码 换一张
取 消