ruby on rails - How should i handle migrations with 2 apps and 1 database -


in our project have 2 distinct apps (3 if think resque workers), use different users same database in remote db server.

the idea 1 app writes stuff on db , other reads stuff db. both have same models same attributes, security reasons 1 app cannot in circumstance write on db.

because of setup have questions:

  1. how can ensure both apps in development have same migrations? should run migrations on 1 , copy code?
  2. if change on 1 model, best way sync changes?
  3. how should handle capistrano migrating database? should ignore it? or should create logic stop servers behind migration?

edit

i've done research , found solutions still don't feel confident using.

  1. creating gem hold model data
    1. too messy handle
    2. for 1 small change need many things update gem
  2. use git submodule or git subtree
    1. not straightforward
    2. nice handle shared models i've no idea migrations

edit 2

i have config each app:

# worker , admin, need write production:   adapter: mysql2   encoding: utf8   reconnect: false   database: my_huge_db_production   pool: 5   username: full_access_user   password: password   socket: /tmp/mysql.sock  # api, need read production:   adapter: mysql2   encoding: utf8   reconnect: false   database: my_huge_db_production   pool: 5   username: only_read_access_user   password: password   socket: /tmp/mysql.sock 

my biggest problem how sync changes on models , migrations when deploy can say: call migrations on admin app

the sinatra app expose api, shouldn't telling business rules of models , tables.

the resque app handle heavy i/o, long requests , stuffs. shouldnt telling nothinng well.

the rails app important app, because should handle business logic, user interface (html/css/javascript). tell how api should be, since api based on models defined on it. think thats 1 handle migrations.

if go deeper, see rails app center point of system. =)


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -