sql - Specify order of fields in DDL generated from GORM classes? -


I use GOMM to generate DDL of my database from Groove classes. Which is the janan. However, the order of the fields in the generated SQL is not the same as the order of the field in the class. For example, if I create a square

  class person {string first name string lastname string address string email}  

The following SQL is generated (MySQL '' '' '' Varta '' (255) No, zero, `` Email 'Varchar (255) No tap,' first_name 'varchar (255) No, zero, last_name' varchar (255) tap, primary key (`id`)) Engine = InnoDB def The default charge = latin1

field is sorted in the alphabetical command (after the Autogenerated ID and version field). This is right. In this example, but I have some very big applause in which the field is important relevant information in order

Here's my question: How do you order the GM to order the fields in the SRQ to declare the fields in the Groove class Can you say for that?

There is no way to specify an order, but you can always create your own tables As you want them and provide name mapping in your domain classes. You can make GORM a table, and then rest the table in the correct order, and after that you can automatically stop the DDL stuff in GORM. If you use area and table names that GORM has chosen, then you will not need to add any mappings.


Comments