DBãã¤ã°ã¬ã¼ã·ã§ã³ãã¼ã«ï¼Schemeãã¤ã°ã¬ã¼ã·ã§ã³ãã¼ã«ï¼: Evolutions 㨠Flywayã«ã¤ãã¦èª¿ã¹ã¦ã¿ã
ã¯ããã«
DBï¼Schemeï¼ãã¤ã°ã¬ã¼ã·ã§ã³ãã¼ã«ã使ãã«ããã£ã¦ï¼ãããã調ã¹ããã¨ãã¾ã¨ãã¦ç½®ããã¨æãï¼ åºæ¬çã«ã¯ï¼Evolutionsã¨Flywayç¦ç¹ããã¦ã¦ã¾ãï¼ ãã®2ã¤ã®ã©ã¡ããæ¡ç¨ããã°ããããèããããã«èª¿æ»ãã¾ããï¼ å®ç¸¾ãéç¨æã®å¤±æãªã©ãããã°æãã¦ããã ããã¨å¹¸ãã§ãï¼
DBãã¤ã°ã¬ã¼ã·ã§ã³ãã¼ã«ã¨ã¯ä½ããããã®ãªã®ã
DBãã¤ã°ã¬ã¼ã·ã§ã³ã¨ã¯DBMSã®ç§»è¡ããããã¨ã§ï¼ä¾ãã°MySQLããPostgreSQLã¸ç§»è¡ããã¨ãï¼ï¼ ããããµãã¼ããããã¼ã«ã®ãã¨ãæãï¼ ãã®æ©è½ã¯ï¼Railsã§ãã¡æ©ãæ¡ç¨ããããããï¼Rubyã«ã¯Migr8ã¨ããã®ãããï¼ï¼ ãããï¼èª¿ã¹ã¦ããã¨DBMSã®ç§»è¡ã¨ããæå³ãããï¼ TABLEã®Schemeãã¤ã°ã¬ã¼ã·ã§ã³ã®ãã¨ãæãã¦è¨ã£ã¦ãããã¨ããã£ãï¼
EvolutionsãFlywayãPlainãªSQLãã¡ã¤ã«ã使ã£ãSchemeãã¤ã°ã¬ã¼ã·ã§ã³ãã¼ã«ï¼ ç°¡åã«è¨ãã¨ï¼ã¹ãã¼ãã®ãã¼ã¸ã§ã³ç®¡çã®ãããªãã®ï¼ ã¨è¨ãã¤ã¤ãï¼TABLEã«ã¯ãã¼ã¿ãå ¥ã£ã¦ããããï¼ç¹å®ã®ãã¼ã¸ã§ã³ã«æ»ãã®ã¯é£ããï¼
è¨è¿°æ¹æ³
- DSLã§æ¸ããã®ãï¼çã®SQLãè¨è¿°
- XMLã§DBMSã«ä¾åããªãå½¢ã§è¨è¿°
- EvolutionsãFlywayã¯çã®SQLã§è¨è¿°
è¨è¿°å 容
大ããåãã¦Upã¨Downãããï¼ - Up: ãã¼ã¸ã§ã³ãä¸ããã¨ãã®åä½ï¼Railsã§ã¯ migrateï¼ - Downs ãã¼ã¸ã§ã³ãæ»ãã¨ãã®åä½ï¼Railsã§ã¯ rollbackï¼
ããã§ï¼Evolutionsã¨flywayãã¿ã¦ã¿ãã¨ï¼ åºæ¬çã«ã©ã£ã¡ãrollbackã¯ã§ããªãï¼gitã¿ããã«åã®ãã¼ã¸ã§ã³ã«ãã¤ãã¨æ»ããªãï¼ï¼ Flywayã¯ããããDownsãåå¨ããªãï¼éã«å®å ¨ï¼ï¼ï¼
Evolutionsã®æå
æåãããããã¨ã®åãããEvolutionsï¼
Downsã«ã¤ãã¦
Downã¯ãã¤å®è¡ããããã¨ãã件ã調ã¹ã¦ããã次ã®ãããªè¨äºããã£ãï¼
ç°¡åã«è¨³ãã¨ï¼ Downsã¯ã¹ã¯ãªãããå¤æ´ãããæã«ä½¿ãããï¼ 2.sqlããã£ã¦ï¼2.sqlãå¤æ´ãããã¨ããï¼ããã¨Playã¯Downsãèµ°ããã¦ããæ°ãã2.sqlã®Upsãèµ°ãããï¼ ç¥ããããã§ã¯Downsãæåã§å®è¡ããæ¹æ³ã¯ãªãï¼ããã¯Applicationã¨DBã®é¢ä¿ãå´©ãç¶æ ã«ãªãããï¼ã¨ã©ã¼ãèµ·ããå¯è½æ§ãããï¼ ããï¼æ»ãããå¤æ´ãæ¸ããªã3.sqlã®Upsã«æ¸ãã¨ããï¼
 sqlãã¡ã¤ã«ã«å¤æ´ããã£ãå ´åã®å®è¡é åºã«ã¤ãã¦
ç°¡åã«ã¾ã¨ããã¨ï¼ Evolutionsã¯ä¸çªpurefixã®å¤§ããSQLãã¡ã¤ã«ã«å¤æ´ããã£ãå ´åï¼å¯¾è±¡ã®ãã¡ã¤ã«ã®Downsãèµ°ã£ã¦ããæ°ããUpsãèµ°ãï¼
Flywayã¨Evolutions
- ã©ã¡ããplay-pluginãã
- Flywayã¯DBPluginéä¾å
- Flywayã¯Upsã®ã¿ - Flywayã¯CLIããã
Flywayã¨Evolutionsã¨ãããã¤ã¤ãï¼Flywayã«é¢ãããã¨ããæ¸ãã¦ãªãï¼ Evolutionsãé¸ã¶çç±ãç¹ã«ãªãã¨ããã®ãããï¼ï¼ï¼
ã©ããã£ã¦é¸ã¶ã®ãï¼
- ããããSchemeãã¤ã°ã¬ã¼ã·ã§ã³ãã¼ã«ã使ã£ã¦ç®¡çããå¿ è¦ãããã®ãï¼
- DB-pluginã«ä¾åãã¦ãããã®ãï¼åé¡ãªããï¼
- Downsã¯å¿ è¦ãï¼ä¸è¦ãï¼
- DSLãçSQLãï¼
ãªã©ã®æ¡ä»¶ãèããæãã«ãªãããï¼
é¸æè¢
- gitã§ç®¡ç
- Evolutionsã使ã
- Flywayã使ã
- Liquibaseã使ãï¼XMLï¼
Evolutionsã¯ããããï¼è¯ãåãèããªãã®ã§ã¾ãå´ä¸ï¼ LiqibaseãDBMSã®éæ¿ãã¨ãã¯èããªãã®ã§å´ä¸ï¼ gitã§ãï¼Flywayã®ã©ã£ã¡ãããªã¨ããæãï¼ Playã¨é£æºãããã¨ããã¨Flywayããªãï¼
 Evolutionsã使ã£ã人éã®å£°
- ãã¤åããããããããªã
- ã³ãã³ãã§ä»»æã®ã¿ã¤ãã³ã°ã§åãããª
- evolutions ã®åä½ã«ã¤ãã¦è³ªåã§ã
åèæç®
- Play! framework Evolutionsã®sqlãã¡ã¤ã«ã®åªå é ä½
- Rolling an evolution back
- ããããªã play-evolutions
- Flywayã®playãã©ã°ã¤ã³
- DBãã¤ã°ã¬ã¼ã·ã§ã³ãFlywayã§è¡ãªã
- Javaã®DBãã¤ã°ã¬ã¼ã·ã§ã³ãã¼ã«ã試ãã¦ã¿ã
- evolutions ã®åä½ã«ã¤ãã¦è³ªåã§ã
- DBã¹ãã¼ãããã¼ã¸ã§ã³ç®¡çãããï¼
- ãã¼ã¿ãã¼ã¹ã¨ããªã¥ã¼ã·ã§ã³ã®ç®¡ç
- Flywayã§DBã¹ãã¼ãã®ãã¤ã°ã¬ã¼ã·ã§ã³ããã¦ã¿ã
- DBãã¤ã°ã¬ã¼ã·ã§ã³ãã¼ã«: Liquibase 㨠Flyway ã®æ¯è¼è°è«