how to giving name to database index ?

View: New views
3 Messages — Rating Filter:   Alert me  

how to giving name to database index ?

by adwin grails :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

if we create domain :

class User{
    String name ;
    String address ;
   .....
   Job job ;
}

now if I need to remove Job from User, I need to remove the index first right ?
I got the problem because I have to manually remove from database and
the index name generated by GORM, which is random characters like
FAK1992ABAJSH

how to giving name index like the field name instead of using
FAK1992ABAJSH, name index with FKUserJob for example.

is it possible ?
because I need to create liquibase script to do migration on some
servers. If not, I need to edit each server manually (which is the
last choice)

thank you !!

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



RE: how to giving name to database index ?

by Matthew.Lachman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

From http://www.grails.org/GORM+-+Mapping+DSL, modified for your example

class User {
  String name
  String address
  //....
  Job job
 
  static mapping = {
      table 'user_table'
      columns {
          job column:'user_job', index:'user_job_idx'
      }
  }
}

HTH,
Matt

-----Original Message-----
From: adwin grails [mailto:callmeblessed.grails@...]
Sent: Friday, November 06, 2009 10:33 AM
To: user
Subject: [grails-user] how to giving name to database index ?

Hi,

if we create domain :

class User{
    String name ;
    String address ;
   .....
   Job job ;
}

now if I need to remove Job from User, I need to remove the index first
right ?
I got the problem because I have to manually remove from database and
the index name generated by GORM, which is random characters like
FAK1992ABAJSH

how to giving name index like the field name instead of using
FAK1992ABAJSH, name index with FKUserJob for example.

is it possible ?
because I need to create liquibase script to do migration on some
servers. If not, I need to edit each server manually (which is the
last choice)

thank you !!

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email




---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: how to giving name to database index ?

by adwin grails :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thank you matt ...

Let me try this ...



On Fri, Nov 6, 2009 at 10:52 PM,  <Matthew.Lachman@...> wrote:

> From http://www.grails.org/GORM+-+Mapping+DSL, modified for your example
>
> class User {
>  String name
>  String address
>  //....
>  Job job
>
>  static mapping = {
>      table 'user_table'
>      columns {
>          job column:'user_job', index:'user_job_idx'
>      }
>  }
> }
>
> HTH,
> Matt
>
> -----Original Message-----
> From: adwin grails [mailto:callmeblessed.grails@...]
> Sent: Friday, November 06, 2009 10:33 AM
> To: user
> Subject: [grails-user] how to giving name to database index ?
>
> Hi,
>
> if we create domain :
>
> class User{
>    String name ;
>    String address ;
>   .....
>   Job job ;
> }
>
> now if I need to remove Job from User, I need to remove the index first
> right ?
> I got the problem because I have to manually remove from database and
> the index name generated by GORM, which is random characters like
> FAK1992ABAJSH
>
> how to giving name index like the field name instead of using
> FAK1992ABAJSH, name index with FKUserJob for example.
>
> is it possible ?
> because I need to create liquibase script to do migration on some
> servers. If not, I need to edit each server manually (which is the
> last choice)
>
> thank you !!
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email