{"id":4585,"date":"2014-12-05T12:00:25","date_gmt":"2014-12-05T03:00:25","guid":{"rendered":"http:\/\/www.techscore.com\/blog\/?p=4585"},"modified":"2018-11-14T16:33:50","modified_gmt":"2018-11-14T07:33:50","slug":"rails_db_migration","status":"publish","type":"post","link":"https:\/\/www.techscore.com\/blog\/2014\/12\/05\/rails_db_migration\/","title":{"rendered":"Rails\u8907\u6570DB\u30b7\u30b9\u30c6\u30e0MySQL\u304b\u3089PostgreSQL\u79fb\u884c\u7269\u8a9e"},"content":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\u3001\u4e09\u82eb\u3067\u3059\u3002<\/p>\n<p>\u3053\u306e\u8a18\u4e8b\u306f<a href=\"http:\/\/www.techscore.com\/blog\/2014\/11\/27\/techscore-advent-calendar-2014\/\">TECHSCORE Advent Calendar 2014<\/a>\u30015\u65e5\u76ee\u306e\u8a18\u4e8b\u3067\u3059\u3002<\/p>\n<p>\u8fd1\u5e74\u3001<a href=\"http:\/\/connpass.com\/event\/9560\/\">Rails\u8907\u6570DB Casual Talks<\/a>\u304c\u958b\u50ac\u3055\u308c\u308b\u306a\u3069\u3001Rails\u3067\u3082\u8907\u6570\u30fb\u7570\u7a2e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u6df7\u5728\u3057\u305f\u30b7\u30b9\u30c6\u30e0\u69cb\u6210\u306f\u4f55\u3089\u7279\u5225\u3067\u306a\u3082\u306e\u3067\u306f\u306a\u304f\u901a\u5e38\u306e\u958b\u767a\u3067\u30ab\u30b8\u30e5\u30a2\u30eb\u306b\u9078\u629e\u3055\u308c\u308b\u69cb\u6210\u3060\u305e\u3068\u3044\u3046\u6a5f\u904b\u304c\u9ad8\u307e\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><a href=\"http:\/\/togetter.com\/li\/743748\">togetter<\/a>\u3067\u53c2\u52a0\u8005\u306e\u53cd\u5fdc\u3092\u898b\u3066\u3082\u3001\u300cestablish_connection\u306f\u57fa\u672c\u300d\u300c\u524d\u306b\u3082\u898b\u305f\u305e\u3053\u306e\u30b9\u30e9\u30a4\u30c9\u300d\u306a\u3069\u3001\u304a\u304a\u3080\u306d\u77e5\u898b\u304c\u696d\u754c\u5168\u4f53\u306b\u5e83\u307e\u308a\u3064\u3064\u3042\u308b\u4e8b\u304c\u308f\u304b\u308a\u307e\u3059\u3002<\/p>\n<p>\u672c\u8a18\u4e8b\u306fRails\u8907\u6570DB\u304c\u307e\u3060\u30ab\u30b8\u30e5\u30a2\u30eb\u3067\u306f\u306a\u3044\u6642\u4ee3\u3001\u30de\u30eb\u30c1\u30c6\u30ca\u30f3\u30c8\u30b7\u30b9\u30c6\u30e0\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092MySQL\u304b\u3089PostgreSQL\u306b\u3001\u5404\u30b5\u30d6\u30b7\u30b9\u30c6\u30e0\u306f\u7e2e\u9000\u3057\u3064\u3064\u3082\u3001\u30b7\u30b9\u30c6\u30e0\u5168\u4f53\u3068\u3057\u3066\u306f\u7121\u505c\u6b62\u3067\u79fb\u884c\u3092\u884c\u3063\u305f\u8a18\u9332\u3092\u5171\u6709\u3059\u308b\u305f\u3081\u306e\u3082\u306e\u3067\u3059\u3002<\/p>\n<h1>\u79fb\u884c\u3057\u305f\u30b7\u30b9\u30c6\u30e0\u306e\u524d\u63d0<\/h1>\n<ul>\n<li>\u30de\u30eb\u30c1\u30c6\u30ca\u30f3\u30c8\u30b7\u30b9\u30c6\u30e0<\/li>\n<li>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306fMySQL<\/li>\n<li>\u30c6\u30ca\u30f3\u30c8\u7ba1\u7406\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u304c1\u3064<\/li>\n<li>\u5404\u30c6\u30ca\u30f3\u30c8\u304c\u305d\u308c\u305e\u308c\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u4e00\u3064\u6301\u3064<\/li>\n<li>\u5404\u30c6\u30ca\u30f3\u30c8\u306e\u30c6\u30fc\u30d6\u30eb\u7fa4\u306f\u307b\u3068\u3093\u3069\u540c\u3058\u3060\u304c\u3001\u30b7\u30b9\u30c6\u30e0\u3067\u52d5\u7684\u306bDDL\u3092\u767a\u884c\u3057\u3066\u3044\u308b\u305f\u3081\u30c6\u30ca\u30f3\u30c8\u56fa\u6709\u306e\u30c6\u30fc\u30d6\u30eb\u304c\u591a\u6570\u5b58\u5728\u3059\u308b<\/li>\n<\/ul>\n<p>\u3064\u307e\u308a\u3053\u3093\u306a\u611f\u3058\u3002\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u6570\u304cN+1\u4ef6\u3002<\/p>\n<p><img loading=\"lazy\" class=\"alignnone\" src=\"https:\/\/cacoo.com\/diagrams\/OCgN4dnJwdxUWM1D-FFD7A.png\" alt=\"\" width=\"371\" height=\"496\" \/><\/p>\n<h1>\u79fb\u884c\u5185\u5bb9<\/h1>\n<ul>\n<li>MySQL\u304b\u3089PostgreSQL\u306b\u5168\u9762\u79fb\u884c<\/li>\n<li>\u5404\u30c6\u30ca\u30f3\u30c8\u306e\u79fb\u884c\u4e2d\u306b\u3001\u79fb\u884c\u5bfe\u8c61\u306e\u30c6\u30ca\u30f3\u30c8\u304c\u6570\u6642\u9593\u505c\u6b62\u3059\u308b\u3053\u3068\u306f\u8a31\u5bb9\u3059\u308b\u304c\u30b7\u30b9\u30c6\u30e0\u5168\u4f53\u3068\u3057\u3066\u306e\u505c\u6b62\u306fNG<\/li>\n<li>\u5404\u30c6\u30ca\u30f3\u30c8\u306e\u505c\u6b62\u6642\u671f\u306f\u500b\u5225\u8abf\u6574\u306a\u306e\u3067MySQL\u3068PostgreSQL\u306eDB\u304c\u6df7\u5728\u3059\u308b\u6642\u671f\u304c\u3042\u308b\uff08\u6570\u304b\u6708\u7a0b\u5ea6\uff09<\/li>\n<\/ul>\n<p>\u3064\u307e\u308a\u3053\u3093\u306a\u611f\u3058\u3002<\/p>\n<p><img loading=\"lazy\" class=\"alignnone\" src=\"https:\/\/cacoo.com\/diagrams\/OCgN4dnJwdxUWM1D-A4144.png\" alt=\"\" width=\"723\" height=\"400\" \/><\/p>\n<p>\u3055\u3059\u304c\u306b30\u4ee3\u4e2d\u5e74\u793e\u54e1\u306e\u79c1\u3082\u3053\u308c\u306f\u30ab\u30b8\u30e5\u30a2\u30eb\u3068\u547c\u3070\u306a\u3044\u3067\u3059\u306d\uff5e\u3002<\/p>\n<h1>\u4f55\u3092\u691c\u8a0e\u3057\u306a\u3051\u308c\u3070\u3044\u3051\u306a\u3044\u304b\uff1f<\/h1>\n<p>\u3055\u3066\u3001\u3053\u306e\u3088\u3046\u306a\u8981\u4ef6\u3092\u51fa\u3055\u308c\u305f\u5834\u5408\u3001\u8003\u3048\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u3053\u3068\u3068\u3044\u3046\u306e\u306f\u3044\u308d\u3044\u308d\u3042\u308a\u307e\u3059\u3002<br \/>\n\u305d\u3082\u305d\u3082\u3001\u3053\u308c\u306f\u672c\u5f53\u306b\u3084\u3089\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u4e8b\u306a\u306e\u304b\u3068\u3044\u3046\u8a71\u306a\u3069\u3082\u3082\u3061\u308d\u3093\u3042\u308a\u307e\u3059\u304c\u3001\u4eca\u56de\u306f\u305d\u306e\u5148\u306b\u8b70\u8ad6\u3092\u9032\u3081\u307e\u3059\u3002<\/p>\n<p>\u3056\u3063\u304f\u308a\u3068\u3001\u3053\u3093\u306a\u3053\u3068\u3092\u691c\u8a0e\u3057\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u3067\u3059\u306d\u3002<\/p>\n<ul>\n<li>MySQL\u306e\u30c7\u30fc\u30bf\u3092\u3069\u3046\u3084\u3063\u3066PostgreSQL\u306b\u79fb\u884c\u3059\u308b\u304b<br \/>\n\uff08\u30c6\u30fc\u30d6\u30eb\u5b9a\u7fa9\u3001\u30d3\u30e5\u30fc\u5b9a\u7fa9\u3001\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3001\u30c7\u30fc\u30bf\uff09<\/li>\n<li>\u79fb\u884c\u3057\u305f\u30c7\u30fc\u30bf\u306e\u6b63\u5f53\u6027\u3092\u3069\u3046\u3084\u3063\u3066\u691c\u8a3c\u30fb\u4fdd\u8a3c\u3059\u308b\u304b<\/li>\n<li>MySQL\u7279\u6709\u306e\u6319\u52d5\u3092PostgreSQL\u306b\u3069\u3046\u3084\u3063\u3066\u30a8\u30df\u30e5\u30ec\u30fc\u30c8\u3059\u308b\u304b<\/li>\n<li>\u7570\u7a2e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u6df7\u5728\u671f\u9593\u3001\u30b7\u30b9\u30c6\u30e0\u306f\u3069\u306e\u3088\u3046\u306a\u69cb\u6210\u306b\u3059\u308b\u304b\u3002\u305d\u306e\u9593\u3082\u4fdd\u5b88\u3084\u958b\u767a\u306f\u884c\u3046\u3002<\/li>\n<li>\u30c7\u30fc\u30bf\u79fb\u884c\u4e2d\u306b\u5bfe\u8c61\u306e\u30c6\u30ca\u30f3\u30c8\u3067\u5b9f\u65bd\u3067\u304d\u306a\u304b\u3063\u305f\u30b8\u30e7\u30d6\u306f\u3069\u306e\u3088\u3046\u306b\u30ea\u30ab\u30d0\u30ea\u3059\u308b\u304b<\/li>\n<\/ul>\n<p>\u6b63\u76f4\u3001\u3053\u3093\u306a\u3053\u3068\u30aa\u30c3\u30b5\u30f3\u306f\u4e00\u5ea6\u3082\u3084\u3063\u305f\u3053\u3068\u306a\u3044\u3063\u3059\u3002\u77e5\u898b\u30bc\u30ed\u30b9\u30bf\u30fc\u30c8\uff01(^v^)<\/p>\n<h2>MySQL\u306e\u30c7\u30fc\u30bf\u3092\u3069\u3046\u3084\u3063\u3066PostgreSQL\u306b\u79fb\u884c\u3059\u308b\u304b<\/h2>\n<p>MySQL\u3068PostgreSQL\u306e\u30c7\u30fc\u30bf\u306e\u30d0\u30a4\u30ca\u30ea\u30d5\u30a1\u30a4\u30eb\u306b\u306f\u4e92\u63db\u6027\u304c\u3042\u308a\u307e\u305b\u3093\u3002\u30c7\u30fc\u30bf\u3092\u79fb\u884c\u3059\u308b\u306b\u306f\u7570\u7a2eDB\u9593\u3092OR\u30de\u30c3\u30d1\u30fc\u3067\u7e4b\u3050\u3068\u3044\u3046\u30a2\u30d7\u30ed\u30fc\u30c1\u3082\u6709\u308a\u305d\u3046\u3067\u3059\u304c\u3001\u79c1\u305f\u3061\u306e\u30b7\u30b9\u30c6\u30e0\u306f\u30c6\u30fc\u30d6\u30eb\u5b9a\u7fa9\u304c\u5404\u30c6\u30ca\u30f3\u30c8\u3067\u7570\u306a\u308b\u306e\u3067\u30c6\u30fc\u30d6\u30eb\u5b9a\u7fa9\u306e\u79fb\u884c\u306f\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u6bce\u306b\u8ad6\u7406\u30c0\u30f3\u30d7\u3092\u3068\u308b\u3057\u304b\u306a\u3055\u305d\u3046\u3067\u3059\u3002<br \/>\n\u3069\u3046\u305b\u30c0\u30f3\u30d7\u3092\u3068\u308b\u306a\u3089\u30c7\u30fc\u30bf\u3082\u30c0\u30f3\u30d7\u3057\u3001\u30d2\u30e5\u30fc\u30de\u30f3\u30ea\u30fc\u30c0\u30d6\u30eb\u306a\u30c6\u30ad\u30b9\u30c8\u306eSQL\u30d5\u30a1\u30a4\u30eb\u3092PostgreSQL\u306b\u6295\u5165\u3067\u304d\u308b\u3088\u3046\u30af\u30a8\u30ea\u3092\u66f8\u304d\u63db\u3048\u308b\u306e\u304c\u826f\u3055\u305d\u3046\u3067\u3059\u3002\u65e2\u5b58\u306eDB\u79fb\u884c\u30c4\u30fc\u30eb\u3082\u691c\u8a0e\u3057\u306a\u304b\u3063\u305f\u308f\u3051\u3067\u306f\u306a\u3044\u306e\u3067\u3059\u304c\u3001\u81ea\u4fe1\u3092\u3082\u3063\u3066\u3053\u308c\u3092\u4f7f\u304a\u3046\u3068\u8a00\u3048\u308b\u3082\u306e\u306f\u306a\u304b\u3063\u305f\u5370\u8c61\u3067\u3059\u3002<\/p>\n<p>\u30c0\u30f3\u30d7\u30d5\u30a1\u30a4\u30eb\u7f6e\u63db\u30a2\u30d7\u30ed\u30fc\u30c1\u3067\u307e\u305a\u554f\u984c\u306b\u306a\u308b\u306e\u304c\u578b\u306e\u4e92\u63db\u6027\u3067\u3059\u3002Rails\u306fMySQL\u306etinyint(1)\u306fboolean\u3068\u3057\u3066\u6271\u3044\u307e\u3059\u3001blob\u306fbytea\u306b\u3057\u307e\u3057\u3087\u3046\u3002\u5730\u9053\u306bDDL\u3092\u6587\u5b57\u5217\u7f6e\u63db\u3059\u308b\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u66f8\u304d\u307e\u3059\u3002\u30c7\u30fc\u30bf\u3082\u540c\u69d8\u306b\u5fc5\u8981\u3042\u3089\u3070\u7f6e\u63db\u3067\u3059\u3002\u30d0\u30a4\u30ca\u30ea\u578b\u306f\u30c7\u30fc\u30bf\u306e\u8868\u73fe\u304c\u5fae\u5999\u306b\u9055\u3046\u306e\u3067\u7f6e\u63db\u30ed\u30b8\u30c3\u30af\u3092\u66f8\u304f\u306e\u306f\u5927\u5909\u3067\u3059\u306d\u3002<br \/>\nauto_increment\u3082\u96e3\u3057\u3044\u3067\u3059\u306d\u3002serial\u578b\u306b\u7f6e\u304d\u63db\u3048\u305f\u4e0a\u3067\u3001\u305d\u306e\u9805\u76ee\u306e\u6700\u5927\u5024+1\u3067setval\u3057\u3066\u304a\u304b\u306a\u3051\u308c\u3070\u540c\u3058ID\u304c\u91cd\u8907\u767a\u884c\uff01<\/p>\n<p>\u69cb\u6587\u89e3\u6790\u305b\u305a\u306b\u6b63\u898f\u8868\u73fe\u7f6e\u63db\u3057\u305f\u3060\u3051\u3060\u3068\u3001\u30af\u30a8\u30ea\u3068\u3057\u3066\u30d1\u30fc\u30b5\u30fc\u304c\u89e3\u91c8\u53ef\u80fd\u306a\u306e\u304b\u4e0d\u5b89\u3067\u3059\u306d\u3002Python\u306ePgSanity(\u00a0<a href=\"https:\/\/github.com\/markdrago\/pgsanity\">https:\/\/github.com\/markdrago\/pgsanity<\/a>\u00a0)\u3068\u3044\u3046\u30c4\u30fc\u30eb\u3092\u4f7f\u3063\u3066PostgreSQL\u306e\u69cb\u6587\u3068\u3057\u3066\u8aa4\u308a\u304c\u306a\u3044\u304b\u691c\u8a3c\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u3053\u3093\u306a\u611f\u3058\u3002<\/p>\n<p><img loading=\"lazy\" class=\"alignnone\" src=\"https:\/\/cacoo.com\/diagrams\/OCgN4dnJwdxUWM1D-889B4.png\" alt=\"\" width=\"513\" height=\"162\" \/><\/p>\n<h2>\u79fb\u884c\u3057\u305f\u30c7\u30fc\u30bf\u306e\u6b63\u5f53\u6027\u3092\u3069\u3046\u3084\u3063\u3066\u691c\u8a3c\u30fb\u4fdd\u8a3c\u3059\u308b\u304b<\/h2>\n<p>\u3055\u3042\u3001\u3053\u308c\u3067MySQL\u304b\u3089PostgreSQL\u306b\u30c7\u30fc\u30bf\u79fb\u884c\u3067\u304d\u308b\uff01<br \/>\n\u3051\u3069\u3053\u306e\u30c7\u30fc\u30bf\u306fRails\u306e\u30a2\u30d7\u30ea\u304b\u3089\u898b\u305f\u3089\u540c\u4e00\u306e\u3082\u306e\u3068\u547c\u3079\u308b\u306e\u304b\u306a\uff1f\u76ee\u8996\u3067\u78ba\u8a8d\u3067\u304d\u308b\u30ec\u30d9\u30eb\u3067\u306f\u540c\u3058\u306b\u898b\u3048\u308b\u3051\u3069\u5168\u90e8\u306e\u30c7\u30fc\u30bf\u304c\u305d\u3046\u306a\u306e\u304b\u306a\uff1f\u3069\u3046\u3084\u3063\u3066\u691c\u8a3c\u3057\u3088\u3046\u3001\u4fdd\u8a3c\u3057\u3088\u3046\uff1f<\/p>\n<p>Rails\u304b\u3089\u5168\u30c7\u30fc\u30bf\u3092\u898b\u3066\u307f\u308b\u3057\u304b\u306a\u3044\u3088\u306d\u3002\u5168\u30c6\u30fc\u30d6\u30eb\u306b\u5bfe\u5fdc\u3059\u308b\u30e2\u30c7\u30eb\u3092\u52d5\u7684\u751f\u6210\u3057\u3066\u5404\u30ec\u30b3\u30fc\u30c9\u306eattribute\u3092\u8db3\u3057\u3042\u308f\u305b\u3066md5\u3092\u3068\u3063\u305f\u30ea\u30b9\u30c8\u3092MySQL\u3068PostgreSQL\u306e\u305d\u308c\u305e\u308c\u3067\u4f5c\u308d\u3046\u3002\u305d\u306e\u30ea\u30b9\u30c8\u306ediff\u3092\u53d6\u3063\u3066\u5dee\u7570\u304c\u306a\u3051\u308c\u3070\u3001\u5c11\u306a\u304f\u3068\u3082ActiveRecord\u30ec\u30a4\u30e4\u3067\u306f\u540c\u4e00\u3060\u3088\u306d\u3002<\/p>\n<p>\u3053\u3093\u306a\u611f\u3058\u306e\u4e8b\u3092\u3059\u308b\u3002<\/p>\n<p><img loading=\"lazy\" class=\"alignnone\" src=\"https:\/\/cacoo.com\/diagrams\/OCgN4dnJwdxUWM1D-59C62.png\" alt=\"\" width=\"452\" height=\"182\" \/><\/p>\n<h2>MySQL\u7279\u6709\u306e\u6319\u52d5\u3092PostgreSQL\u306b\u3069\u3046\u3084\u3063\u3066\u30a8\u30df\u30e5\u30ec\u30fc\u30c8\u3059\u308b\u304b<\/h2>\n<p>\u6697\u9ed9\u7684\u306a\u30ad\u30e3\u30b9\u30c8\u3068\u304b\u3001\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u7121\u8996\u306e\u691c\u7d22\u3068\u304b\u3001ORDER BY\u6642\u306enull\u306e\u6271\u3044\u3068\u304b\u66d6\u6627\u306aGROUP BY\u3068\u304b\u306e\u4e8b\u3067\u3059\u306d\u3002<br \/>\n\u3061\u3087\u3063\u3068\u3057\u305f\u6319\u52d5\u306e\u9055\u3044\u3060\u3057\u4ed5\u69d8\u5909\u66f4\u3068\u8a00\u3048\u3070\u304a\u5ba2\u69d8\u306b\u8a31\u3057\u3066\u3082\u3089\u3048\u306a\u3044\u304b\u306a\uff1f\u30af\u30a8\u30ea\u3092\u5168\u90e8\u691c\u8a3c\u3057\u3066\u66f8\u304d\u63db\u3048\u308b\u5de5\u6570\u3092\u8a8d\u3081\u3066\u3082\u3089\u3048\u306a\u3044\u304b\u306a\uff1f<\/p>\n<p>\u6b8b\u5ff5\uff01\u305d\u308c\u306f\u306a\u304b\u306a\u304b\u901a\u3089\u306a\u3044\u3002\u6700\u77ed\u306e\u5de5\u6570\u3067\u540c\u3058\u6319\u52d5\u3092\u76ee\u6307\u305d\u3046\u3002<\/p>\n<p>PostgreSQL\u306f\u6f14\u7b97\u5b50\u306e\u72ec\u81ea\u5b9a\u7fa9\u304c\u3067\u304d\u308b\u3002citext\u578b\u3092\u4f7f\u3048\u3070\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u7121\u8996\u306e\u691c\u7d22\u3092\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u6319\u52d5\u306e\u3088\u3046\u306b\u898b\u305b\u308b\u3053\u3068\u304b\u3067\u304d\u308b\u3002<br \/>\n\u8272\u3005\u9053\u3092\u63a2\u308d\u3046\u3002\u305d\u308c\u3067\u3082\u5bfe\u5fdc\u3067\u304d\u306a\u3044\u554f\u984c\u306f\u4ed5\u65b9\u304c\u306a\u3044\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u4fee\u6b63\u3057\u30af\u30a8\u30ea\u3092\u66f8\u304d\u63db\u3048\u3088\u3046\u3002<\/p>\n<h2>\u7570\u7a2e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u6df7\u5728\u671f\u9593\u3001\u30b7\u30b9\u30c6\u30e0\u306f\u3069\u306e\u3088\u3046\u306a\u69cb\u6210\u306b\u3059\u308b\u304b\u3002\u305d\u306e\u9593\u3082\u4fdd\u5b88\u958b\u767a\u306f\u884c\u3046\u3002<\/h2>\n<p>\u3053\u306e\u8fba\u308a\u306b\u306a\u308b\u3068\u3001\u300c\u7406\u5c48\u3067\u8003\u3048\u308d\uff01\u3067\u304d\u308b\u308f\u3051\u306a\u3044\u3060\u308d\u3046\u304c\uff01\u300d\u3068\u304b\u8a00\u3044\u51fa\u3059\u30e1\u30f3\u30d0\u30fc\u304c\u51fa\u3066\u304f\u308b\u3002\uff08\u79c1\u306e\u4e8b\u3067\u3059\uff09<br \/>\n\u7406\u5c48\u3067\u8003\u3048\u3088\u3046\u3002\u73fe\u5b9f\u7684\u306bMySQL\u5bfe\u5fdc\u306e\u30b3\u30fc\u30c9\u30d9\u30fc\u30b9\u3068PostgreSQL\u5bfe\u5fdc\u306e\u30b3\u30fc\u30c9\u30d9\u30fc\u30b9\u3084\u30b5\u30fc\u30d0\u30fc\u3092\u72ec\u7acb\u3057\u3066\u4fdd\u6301\u3057\u3001\u958b\u767a\u3057\u3066\u3044\u304f\u3053\u3068\u306f\u56f0\u96e3\u3060\u3002<br \/>\n\u7570\u7a2e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u6df7\u5728\u671f\u9593\u306f\u63a5\u7d9a\u5148\u306eDB\u306b\u3088\u3063\u3066\u30af\u30a8\u30ea\u3092\u51fa\u3057\u308f\u3051\u308b\u6a5f\u69cb\u3092\u7d44\u307f\u8fbc\u3093\u3060\u3001\u5358\u4e00\u306e\u30b3\u30fc\u30c9\u30d9\u30fc\u30b9\u3067\u7ba1\u7406\u3055\u308c\u3066\u3044\u308b\u306e\u304c\u6700\u826f\u3060\u3002ActiveRecord\u306f\u826f\u304f\u3067\u304d\u3066\u3044\u308b\u306e\u3067\u3001\u3053\u306e\u3088\u3046\u306a\u8981\u4ef6\u306b\u7c21\u5358\u306b\u5fdc\u3048\u3066\u304f\u308c\u308b\u3002<\/p>\n<p>\u8cdb\u5426\u304c\u5206\u304b\u308c\u308b\u3067\u3042\u308d\u3046\u304c\u30b7\u30b9\u30c6\u30e0\u306f\u3053\u306e\u3088\u3046\u306a\u6319\u52d5\u3092\u3057\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u3002<\/p>\n<p><img loading=\"lazy\" class=\"alignnone\" src=\"https:\/\/cacoo.com\/diagrams\/OCgN4dnJwdxUWM1D-CB95F.png\" alt=\"\" width=\"470\" height=\"361\" \/><\/p>\n<h2>\u30c7\u30fc\u30bf\u79fb\u884c\u4e2d\u306b\u5bfe\u8c61\u306e\u30c6\u30ca\u30f3\u30c8\u3067\u5b9f\u65bd\u3067\u304d\u306a\u304b\u3063\u305f\u30b8\u30e7\u30d6\u306f\u3069\u306e\u3088\u3046\u306b\u30ea\u30ab\u30d0\u30ea\u3059\u308b\u304b<\/h2>\n<p>\u307e\u3042\u5f8c\u304b\u3089\u5b9f\u884c\u3059\u308b\u3057\u304b\u306a\u3044\u3088\u306d\u3002\u4e8b\u524d\u306b\u304a\u5ba2\u69d8\u306b\u306f\u505c\u6b62\u6642\u9593\u4e2d\u306e\u5404\u6a5f\u80fd\u306e\u6319\u52d5\u306f\u3069\u306e\u3088\u3046\u306b\u306a\u308b\u304b\u3092\u6574\u7406\u3057\u3066\u304a\u77e5\u3089\u305b\u3057\u3066\u304a\u3053\u3046\u3002<\/p>\n<h1>\u691c\u8a0e\u306e\u3042\u3068\u306f\uff1f<\/h1>\n<p>\u691c\u8a0e\u3057\u3001\u51fa\u3066\u304f\u308b\u3067\u3042\u308d\u3046\u8ab2\u984c\u3068\u305d\u306e\u5bfe\u5fdc\u65b9\u91dd\u3092\u6d17\u3044\u51fa\u305b\u305f\u3089\u3001\u5404\u8ab2\u984c\u3092\u89e3\u6c7a\u3059\u308b\u305f\u3081\u306b\u30a2\u30d7\u30ea\u306e\u4fee\u6b63\u3092\u9032\u3081\u306a\u304c\u3089\u57fa\u76e4\u3092\u69cb\u7bc9\u3057\u3001\u79fb\u884c\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u3092\u305f\u3066\u3088\u3046\u3002\u3069\u3093\u306a\u9806\u756a\u3067\u79fb\u884c\u3092\u9032\u3081\u305f\u3089\u3044\u3044\u3060\u308d\u3046\u3002<\/p>\n<p>\u4eca\u56de\u306f\u7ba1\u7406DB\u304b\u3089\u5148\u306b\u79fb\u884c\u3059\u308b\u3053\u3068\u306b\u3057\u305f\u3002\u305d\u3057\u3066\u3001\u5f90\u3005\u306b\u30c6\u30ca\u30f3\u30c8\u3092PostgreSQL\u306b\u79fb\u3057\u3066\u3044\u3063\u3066\u3001\u6700\u5f8c\u306fMySQL\u306e\u30c6\u30ca\u30f3\u30c8\u306f\u30bc\u30ed\u3060\u3002\u56f3\u306b\u3059\u308b\u3068\u3053\u3093\u306a\u611f\u3058\u3002<\/p>\n<p>\u30b9\u30bf\u30fc\u30c8\u306f\u3053\u3093\u306a\u72b6\u614b<\/p>\n<p><img loading=\"lazy\" class=\"alignnone\" src=\"https:\/\/cacoo.com\/diagrams\/OCgN4dnJwdxUWM1D-3E2D5.png\" alt=\"\" width=\"634\" height=\"332\" \/><\/p>\n<p>\u2193\u6700\u521d\u306e\u30ea\u30ea\u30fc\u30b9\u3067\u3053\u306e\u72b6\u614b\u306b\u3057\u3066\u2193<\/p>\n<p><img loading=\"lazy\" class=\"alignnone\" src=\"https:\/\/cacoo.com\/diagrams\/OCgN4dnJwdxUWM1D-DA5D0.png\" alt=\"\" width=\"629\" height=\"367\" \/><\/p>\n<p>\u2193\u79fb\u884c\u306e\u958b\u59cb\u3060\uff01\u2193<\/p>\n<p><img loading=\"lazy\" class=\"alignnone\" src=\"https:\/\/cacoo.com\/diagrams\/OCgN4dnJwdxUWM1D-D4B99.png\" alt=\"\" width=\"621\" height=\"362\" \/><\/p>\n<p>\u2193\u3069\u3093\u3069\u3093\u79fb\u884c\u3057\u3066\u6700\u5f8c\u306f\u3053\u3046\u306a\u308b\u2193<\/p>\n<p><img loading=\"lazy\" class=\"alignnone\" src=\"https:\/\/cacoo.com\/diagrams\/OCgN4dnJwdxUWM1D-1F097.png\" alt=\"\" width=\"630\" height=\"384\" \/><\/p>\n<p>\u3069\u3046\u3060\u308d\u3046\u3002\u7269\u4e8b\u306f\u5358\u7d14\u5316\u3059\u308b\u3068\u5358\u7d14\u306b\u898b\u3048\u308b\u3002\u3051\u308c\u3069\u3001\u554f\u984c\u3092\u6574\u7406\u3057\u3066\u8ab2\u984c\u3092\u6d17\u3044\u51fa\u3057\u3066\u305d\u306e\u305d\u308c\u305e\u308c\u306b\u3064\u3044\u3066\u3069\u3046\u5bfe\u51e6\u3059\u308b\u304b\u6c7a\u5b9a\u3057\u3066\u3044\u304b\u306a\u3044\u3068\u3053\u3093\u306a\u98a8\u306b\u306f\u3044\u304b\u306a\u3044\u3002<\/p>\n<p>\u3053\u306e\u56f3\u3092\u898b\u3066\u300c\u6050\u308d\u3057\u3044\u306a\u3001\u3048\u3052\u3064\u306a\u3044\u306a\u300d\u3068\u611f\u3058\u305f\u3046\u3048\u3067\u300c\u3084\u308b\u305e\uff01\u300d\u3068\u8a00\u3048\u308b\u304b\u3069\u3046\u304b\u3002\u50d5\u306f\u4eca\u56de\u3084\u308b\u305e\u7c21\u5358\u306b\u3044\u3046\u3053\u3068\u306f\u3067\u304d\u306a\u304b\u3063\u305f\u3002\u3053\u308c\u306f\u30ab\u30b8\u30e5\u30a2\u30eb\u3067\u306f\u306a\u3044\u3057\u3001\u30b7\u30ea\u30a2\u30b9\u306b\u3068\u3089\u3048\u305f\u3046\u3048\u3067\u6e96\u5099\u3092\u9032\u3081\u3066\u3082\u305f\u3081\u3089\u3044\u304c\u51fa\u3066\u304f\u308b\u3082\u306e\u3060\u3002<\/p>\n<p>\u307e\u3042\u3057\u304b\u3057\u3001\u4ed5\u4e8b\u3068\u3044\u3046\u306e\u306f\u4e00\u4eba\u306e\u4e2d\u5e74\u30d7\u30ed\u30b0\u30e9\u30de\u304c\u300c\u6016\u3044\u3088\u3046\u300d\u3068\u9707\u3048\u3066\u3044\u308b\u3060\u3051\u3067\u4e2d\u6b62\u3055\u308c\u308b\u3088\u3046\u306a\u3082\u306e\u3067\u306f\u306a\u3044\u3002\u5b9f\u969b\u306b\u3053\u306e\u8a08\u753b\u306f\u5b9f\u884c\u3055\u308c\u305f\u3057\u3001\u7d30\u304b\u306a\u30c8\u30e9\u30d6\u30eb\u306f\u3042\u3063\u305f\u3051\u3069\u5168\u4f53\u3068\u3057\u3066\u306f\u9a5a\u304f\u307b\u3069\u6210\u529f\u88cf\u306b\u79fb\u884c\u306f\u5b8c\u4e86\u3057\u305f\u3002<\/p>\n<h1>\u8a18\u4e8b\u306e\u52d5\u6a5f<\/h1>\n<p>\u79fb\u884c\u304c\u5224\u65ad\u3055\u308c\u3066\u304b\u3089\u691c\u8a0e\u3084\u4fee\u6b63\u4f5c\u696d\u306b\u8ffd\u308f\u308c\u308b\u306a\u304b\u300cRails\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067\u3053\u3093\u306a\u56f0\u308a\u304b\u305f\u3092\u3057\u3066\u3044\u308b\u306e\u306f\u5f0a\u793e\u3060\u3051\u3067\u306f\uff1f\u300d\u3068\u3044\u3046\u4e0d\u5b89\u304c\u5e38\u306b\u3042\u3063\u305f\u3002\u691c\u7d22\u3057\u3066\u3082\u300cRails\u8907\u6570DB\u30b7\u30b9\u30c6\u30e0\u7570\u7a2e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3078\u306e\u7121\u505c\u6b62\u79fb\u884c\u306e\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\u300d\u306a\u3093\u3066\u51fa\u3066\u3053\u306a\u3044\u3057\u3001\u305d\u3082\u305d\u3082\u8907\u6570DB\u306e\u6642\u70b9\u3067Rails\u306e\u30ec\u30fc\u30eb\u306f\u9280\u6cb3\u9244\u9053999\u306e\u30aa\u30fc\u30d7\u30cb\u30f3\u30b0\u306e\u3088\u3046\u306b\u3001\u3068\u3063\u304f\u306b\u98db\u3073\u8d8a\u3048\u3066\u308b\u3002<\/p>\n<p>\u4e00\u4eba\u3067\u3084\u3063\u305f\u4ed5\u4e8b\u3067\u306f\u306a\u3044\u304c\u3001\u306a\u3093\u3068\u306a\u304f\u4e16\u9593\u69d8\u306f\u3053\u3093\u306a\u3053\u3068\u3084\u3089\u306a\u3044\u3060\u308d\u3046\u3068\u3044\u3046\u5b64\u72ec\u611f\u304c\u3042\u3063\u305f\u3002\u5916\u90e8\u306b\u52a9\u3051\u3092\u6c42\u3081\u3066\u3082\u8ab0\u3082\u7b54\u3048\u3092\u77e5\u3089\u306a\u3044\u3060\u308d\u3046\u611f\u3068\u3044\u3046\u304b\u3002<\/p>\n<p>\u4eca\u56de\u3001\u8907\u6570DB\u30ab\u30b8\u30e5\u30a2\u30eb\u306e\u5b9f\u6cc1\u3084\u305d\u306e\u5f8c\u516c\u958b\u3055\u308c\u305f\u8cc7\u6599\u3092\u773a\u3081\u3066\u308b\u3068\u300c\u3053\u3093\u306a\u3053\u3068\u3092\u3057\u3066\u308b\u306e\u306f\u3046\u3061\u3060\u3051\u3067\u306f\u306a\u304b\u3063\u305f\u3057\u3001\u540c\u3058\u554f\u984c\u306b\u73fe\u5728\u9032\u884c\u5f62\u3067\u60a9\u3093\u3067\u3044\u308b\u4f1a\u793e\u306f\u305f\u304f\u3055\u3093\u6709\u308b\u3060\u308d\u3046\u300d\u3068\u611f\u3058\u305f\u3002\u304d\u3063\u3068\u3053\u306e\u8a18\u4e8b\u304c\u3042\u308c\u3070\u3001\u76f4\u63a5\u306e\u53c2\u8003\u306b\u306a\u3089\u306a\u304b\u3063\u305f\u3068\u3057\u3066\u3082\u985e\u4f3c\u306e\u4e8b\u4f8b\u3068\u3057\u3066\u52c7\u6c17\u3065\u3051\u3089\u308c\u308b\u4eba\u304c\u3044\u308b\u3093\u3058\u3083\u306a\u3044\u304b\u3068\u601d\u3046\u3002\u7d30\u304b\u3044\u3068\u3053\u308d\u304c\u805e\u304d\u305f\u3051\u308c\u3070\u30b3\u30e1\u30f3\u30c8\u3044\u305f\u3060\u3051\u308c\u3070\u7b54\u3048\u3089\u308c\u308b\u7bc4\u56f2\u3067\u7b54\u3048\u307e\u3059\u3002<\/p>\n<p>\u6539\u3081\u3066\u632f\u308a\u8fd4\u3063\u3066\u6587\u7ae0\u306b\u307e\u3068\u3081\u3066\u307f\u308b\u3068\u6280\u8853\u7684\u306b\u697d\u3057\u3081\u308b\u3068\u3053\u308d\u306e\u591a\u3044\u697d\u3057\u3044\u4ed5\u4e8b\u3060\u3063\u305f\u3068\u601d\u3046\u3002\u3053\u3046\u3044\u3046\u4ed5\u4e8b\u3092\u3057\u3066\u307f\u305f\u3044\u3068\u601d\u3046\u30a8\u30f3\u30b8\u30cb\u30a2\u306f\u305c\u3072<a href=\"http:\/\/synergist.jp\/career\/post_13.html\">TECHSCORE\u904b\u55b6\u4f1a\u793e\u306e\u63a1\u7528<\/a>\u306b\u5fdc\u52df\u3057\u3066\u307b\u3057\u3044\u3068\u601d\u3063\u3066\u3044\u307e\u3059\u3002\uff08\u5ba3\u4f1d\u3067\u3059\u3002\uff09<\/p>\n<p>\u305d\u308c\u3067\u306f\u307e\u305f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\u3001\u4e09\u82eb\u3067\u3059\u3002<\/p>\n<p>\u3053\u306e\u8a18\u4e8b\u306fTECHSCORE Advent Calendar 2014\u30015\u65e5\u76ee\u306e\u8a18\u4e8b\u3067\u3059\u3002<br \/><a href=\"https:\/\/www.techscore.com\/blog\/2014\/12\/05\/rails_db_migration\/\">\u7d9a\u304d\u3092\u8aad\u3080...<\/a><\/p>\n","protected":false},"author":15,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[18],"tags":[141,206,22],"_links":{"self":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts\/4585"}],"collection":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/users\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/comments?post=4585"}],"version-history":[{"count":55,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts\/4585\/revisions"}],"predecessor-version":[{"id":4890,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts\/4585\/revisions\/4890"}],"wp:attachment":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/media?parent=4585"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/categories?post=4585"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/tags?post=4585"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}