Grails and MongoDb (persistent instance deletion) -


if have grails application have used persist domain objects database (mongodb in case not matter), , modify domain class, add more properties or take properties away. now, modified version of application newer version of domain class still recognize persisted old version of domain instances?

more importantly if restart grails application new version of domain class, delete(or to) persisted old versions of domain objects? trying chase similar issue facing on team i'm not sure if application deleted old objects db (which don't think so) or did human system user.

the way in grails handles database depends on value of dbcreate property in datasource.groovy.

if declare

datasource {     dbcreate = "update" } 

then additional properties add domain class added columns in database. note not delete columns exist. had property called x , wanted replace property called y, create y column in database x column still remain.

here list of possible values , behaviors dbcreate

  • create - drops existing schema. creates schema on startup, dropping existing tables, indexes, etc. first.

  • create-drop - same create, drops tables when application shuts down cleanly.

  • update - creates missing tables , indexes, , updates current schema without dropping tables or data. note can't handle many schema changes column renames (you're left old column containing existing data).

  • validate - makes no changes database. compares configuration existing database schema , reports warnings.

  • any other value - nothing

hope helps


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -