downã³ãã³ãããªãupã ãã®DBãã¤ã°ã¬ã¼ã·ã§ã³ãã¼ã« Dbup
ビー・バップ・ハイスクールã£ã¦ç¥ã£ã¦ã¾ããï¼ Dカップã£ã¦å¤§ããã§ãããï¼
ã¨ããããã§ãè¶ ã·ã³ãã«ãªDBãã¤ã°ã¬ã¼ã·ã§ã³ãã¼ã« Dbup ãä½ã£ã¦ã¿ãã®ã§ç´¹ä»ã
ã¤ã³ã¹ãã¼ã«ããå®è¡ã¾ã§ã®ãã¢ã³ã¹ãã¬ã¼ã·ã§ã³
- dbup.pharããã¦ã³ãã¼ã
- å¿ è¦ãªãã£ã¬ã¯ããªãè¨å®ãã¡ã¤ã«ãä½æ
- statusã§ç¢ºèªãã¤ã¤ãupã§å®è¡
ç¹å¾´
- æºåã¯dbup.pharããã¦ã³ãã¼ãããã ã
- up ã³ãã³ãããããã¾ãããdown ã³ãã³ãã¯åå¨ãã¾ãã
- ãã¤ã°ã¬ã¼ã·ã§ã³ã®è¨è¿°ã¯è¦ªãã¿ããSQLãã®ã¾ã¾ã§ããORMãDSLãæ°ããè¦ããå¿ è¦ã¯ããã¾ãã
- PHPæ¨æºã®PDOã¯ã©ã¹ãå©ç¨ãã¦ãã¾ã
- ãã¤ã°ã¬ã¼ã·ã§ã³ã®ã¹ãã¼ã¿ã¹ç®¡çã®ããã«ãã¼ã¿ãã¼ã¹ã«å°ç¨ã®ãã¼ãã«ãä½ãå¿ è¦ãããã¾ãã
- è¨å®ãã¡ã¤ã«ã¯iniãã©ã¼ãããã§ããPHPã«ä¾åããªãä¸è¬çãªãã©ã¼ãããã§ãã
- PHP5.4以ä¸ã5.3.xã§ã¯åãã¾ããã
ãªãDBãã¤ã°ã¬ã¼ã·ã§ã³ãã¼ã«ãä½ã£ãã
DBãã¤ã°ã¬ã¼ã·ã§ã³ã¯ãããã¤èªååãç¶ç¶çã¤ã³ãã°ã¬ã¼ã·ã§ã³ã«ããã¦ä¸è¬çã«ä½¿ãããããã«ãªã£ã¦ãã¾ãããPHPã®DBãã¤ã°ã¬ã¼ã·ã§ã³ãã¼ã«ã¨ãã¦ã¯Doctrine2 Migraionãããæãæµ®ãã³ã¾ãããã¬ã¼ã ã¯ã¼ã¯ã«ç¹åããORMã®ä¸é¨ã¨ãã¦ç¨æããã¦ãããã®( CakePHP Migrations Pluginã¨ãCodeIgniterのマイグレーション )ããã£ãããã¾ãã
ãããã¯ãORMã®æ©è½ã®ä¸é¨ã ã£ããããã®ã§ãORMã®ä½¿ãæ¹ãç解ãã¦ããå¿ è¦ããã£ãããDSLãè¦ãããããå¿ è¦ããã£ããã¨æ軽ããããã¾ããã
DBãã¤ã°ã¬ã¼ã·ã§ã³ã¯DBã«å¯¾ãã¦SQLãçºè¡ããã®ããä»äºãªã®ã§ãã¢ããªã®è¨èªã¨ã¯åãã§ããå¿ è¦ã¯ããã¾ããããªã®ã§ãMyBatis Schema Migration*1 ãFlywayã®ãããªãã¼ã«ã使ãã»ããå°å ¥ã楽ã ã£ããåå©ç¨æ§ãé«ãã£ãããã¾ãã
ãã ãããã§ãã¾ã ã³ã¹ããé«ãã¨æã£ã¦ãã¾ããã¨ããã®ã¯ãDBãã¤ã°ã¬ã¼ã·ã§ã³ã¨ããã¨ã¹ãã¼ãã®ãã¼ã¸ã§ã³ãUpãããDownããããã¾ãã¯ç¹å®ã®æç¹ã®ãã¼ã¸ã§ã³ã«æ»ãããã¨ããã®ãã§ãã¦å¹¸ãï¼ã¨ãããã¨ãã§ããããã«ãªã£ã¦ããã®ã§ãããäºå®ä¸Downãç¹å®ã®ãã¼ã¸ã§ã³ã«ãã¤ã°ã¬ã¼ã·ã§ã³ãã¼ã«ã使ã£ã¦å®å ¨ã«æ»ãããã¨ã¯ã¨ã¦ãè³é£ã ã¨æãã¾ãã
ãã¨ãã°ãã«ã©ã ã追å ããã¼ã¿ããã®æ°ããã«ã©ã ã«è¿½å ãããæç¹ã§Downãå®è¡ãã¦ãã¼ã¿ãæ¶ãã¦ãããã©ããã¯å ´åã«ããã¨æãã¾ãããå®éã¯ã¢ããªã±ã¼ã·ã§ã³ããããã¦ãã¼ã«ããã¯ããªãã¦ã¯ãªããªãå ´åãããã¾ãã
ã½ã¼ã¹ã³ã¼ãã¨éããDBãã¤ã°ã¬ã¼ã·ã§ã³ã¯å¸¸ã«æ´å²ãé²ãã¦ãã(Upãã¤ã¥ãã)ã®ãéç¨æ¹æ³ã®1ã¤ã ã¨èãã¾ãã
ãããUpãã¦ä½ãåé¡ãçºçããå ´åããæ°ããSQLãç¨æããã®SQLãçºè¡ãããã¨ã§ä¿®æ£ãè¡ãæ¹æ³ã§ãã
ããã¦ããã®ããã«Upã ãã§ããã°è¯ãã·ã³ãã«ãªãã¤ã°ã¬ã¼ã·ã§ã³ãã¼ã«ãç¡ããããã°è¯ãããªãã£ã¦ãã¨ã§ä½ã£ã¦ã¿ã¾ããã
ããã¥ã¡ã³ãã«æ¸ãã¦ãªããã¨
- å½ããåã§ããããã¬ã¼ã ã¯ã¼ã¯ã¨ãå ¨ãé¢ä¿ãªãã使ãããã¨ãã«ä½¿ãã¾ãã
- PHPç°å¢ã§ããã°ãä»è¨èªã®ããã¸ã§ã¯ãã§ã使ãã¾ãããã¾ãã¾ãPHPã§æ¸ããã¦ãã ãã§ããPDOã®ãã©ã¤ãã対å¿ãã¦ããã°å¤§ä¸å¤«(ãªã¯ã)
- githubããcloneãã¦ãã¦é©å½ã«ã«ã¹ã¿ãã¤ãºããphp dbup compile ããã°ä¿ºãã¤ã°ã¬ã¼ã·ã§ã³ä½ãã¾ã
- å®è£ 㯠Symfony Component ã® Consoleã§ãã®ã§ãSymfonyã®ã³ãã³ãã®ä¸é¨ã¨ãã¦ä½ãè¾¼ããªãã¦ã®ãç°¡å
- ãã¨ããããä½ã£ã¦ã¿ããæãå¼·ãã®ã§ãå®ããã¸ã§ã¯ãã§ä½¿ãã¨ãã¯è¦æ³¨æã§ãã(devç°å¢ãpreç°å¢ãªã©æ¬çªã¨ã¯å¥ç°å¢ã§åå確èªã§ããããã«ãªã£ã¦ããç)
- ãã°è¦ã¤ãããPull Requestãã ãã
ä½ã£ã¦ãã£ããã