database - Grails keep deleting my tables -


i have table structure like:

create table test_two_tabel.t1 ( t1_id int not null auto_increment , a1 int null , b1 varchar(45) null , c1 varchar(45) null , d1 datetime null , primary key (t1_id) );

in grails:

package twotables  class t1 {      integer     string b     string c     date d      static mapping = {         table "t1"         version false         id column:"t1_id"         a1 column:"a1"         b1 column:"b1"         c1 column:"c1"         d1 column:"d1"     }      static constraints = {         id()         a1()         b1()         c1()         d1()     } } 

every time execute program... grails deletes tables in db, know what's happening?

you need change value of dbcreate 'create-drop' 'update' @ grails-app/conf/datasource.groovy

you current value is:

development {     datasource {         dbcreate = "create-drop" // 1 of 'create', 'create-drop','update'         url = "***"     } } 

this means grails recreate tables on every restart. if you'll set update try update table structure, according data model classes.

you can read more grails db configuration @ http://www.grails.org/doc/latest/guide/3.%20configuration.html#3.3%20the%20datasource


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -