{"id":61,"date":"2019-03-05T14:27:59","date_gmt":"2019-03-05T05:27:59","guid":{"rendered":"https:\/\/wordpress.k8s.yukiafronia.com\/?p=61"},"modified":"2020-08-10T16:15:02","modified_gmt":"2020-08-10T07:15:02","slug":"db%e3%83%9e%e3%82%a4%e3%82%b0%e3%83%ac%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3%e3%83%84%e3%83%bc%e3%83%ab-flyway","status":"publish","type":"post","link":"https:\/\/blog.yukiafronia.com\/?p=61","title":{"rendered":"DB\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u30c4\u30fc\u30eb Flyway"},"content":{"rendered":"<h2>Flayway \u6700\u65b0\u30d0\u30fc\u30b8\u30e7\u30f3<\/h2>\n<ul>\n<li>Flyway-commandline-5.2.4  (\u63a8\u5968)<\/li>\n<li>flyway-commandline-6.0.0  (\u30d9\u30fc\u30bf)<br \/>\n<h2>Postgraseql \u5bfe\u5fdc\u30d0\u30fc\u30b8\u30e7\u30f3<\/h2>\n<\/li>\n<li>Postgresql 10  <\/li>\n<li>Postgresql 9.6  <\/li>\n<li>Postgresql 9.5<\/li>\n<li>Postgresql 9.4<\/li>\n<li>Postgresql 9.3<\/li>\n<\/ul>\n<h2>Postgresql JDBC \u5bfe\u5fdc\u30d0\u30fc\u30b8\u30e7\u30f3<\/h2>\n<ul>\n<li>PostgreSQL JDBC 42.2.5<\/li>\n<\/ul>\n<h2>Java \u5bfe\u5fdc\u30d0\u30fc\u30b8\u30e7\u30f3<\/h2>\n<ul>\n<li>Java 8 \/ 9 \/ 10 \/ 11  <\/li>\n<\/ul>\n<hr \/>\n<h1>DB\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u30c4\u30fc\u30eb Flyway \u30ec\u30dd\u30fc\u30c8<\/h1>\n<h2>\u51fa\u6765\u308c\u3070\u3044\u3044\u306a\u3041<\/h2>\n<ul>\n<li>DB\u306b\u4efb\u610f\u306e\u30c6\u30fc\u30d6\u30eb\u3092\u4f5c\u6210  <\/li>\n<li>\u30c7\u30fc\u30bf\u304c\u767b\u9332\u3067\u304d\u308b  <\/li>\n<li>\u30ab\u30e9\u30e0\u306e\u8ffd\u52a0\u3084\u524a\u9664\u304c\u884c\u3048\u308b  <\/li>\n<li>\u767b\u9332\u3057\u305f\u30c7\u30fc\u30bf\u306e\u66f4\u65b0\u304c\u884c\u3048\u308b  <\/li>\n<li>\u4efb\u610f\u884c\u306b\u30ab\u30e9\u30e0\u3092\u8ffd\u52a0\u3067\u304d\u308b  <\/li>\n<\/ul>\n<p>\u3053\u308c\u3089\u3092\u4e00\u5fdc\u5ff5\u982d\u306b\u5165\u308c\u305f\u72b6\u614b\u3067\u9032\u3081\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<h2>Flyway\u74b0\u5883\u3092\u69cb\u7bc9\u3059\u308b<\/h2>\n<p>\u304a\u304a\u307e\u304b\u306a\u3001\u30d7\u30ed\u30bb\u30b9<br \/>\n1.CentOS\u3092\u5165\u308c\u308b<br \/>\n2.postgresql9.3\uff5e \u3092\u5165\u308c\u308b<br \/>\n3.flyway\u3092wget\u306a\u308acurl\u306a\u308a\u3067\u843d\u3068\u3057\u3066\u304f\u308b<br \/>\n4.postgresql\u3078\u306e\u30a2\u30af\u30bb\u30b9\u4ef6\u3092trust\u306b\u3057\u3066flyway\u3067\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3002<\/p>\n<p>\u7c21\u5358\u305d\u3046\u306b\u898b\u3048\u307e\u3059\u304c\u3001<strong>\uff83\uff9e\uff70\uff80\uff8d\uff9e\uff70\uff7d\uff1f \u306a\u306b\u305d\u308c\u304a\u3044\u3057\u3044\u306e\uff1f<\/strong> \u3068\u3044\u3046\u611f\u3058\u306e\u79c1\u306b\u3068\u3063\u3066\u306f\u82e6\u96e3\u306e\u9053\u306e\u308a\u3067\u3082\u3042\u308a\u307e\u3057\u305f\u3002<br \/>\n\u3067\u306f\u3084\u3063\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<h3>CentOS\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306f\u98db\u3070\u3057\u307e\u3059\u3002\u9762\u767d\u3044\u3053\u3068\u3042\u308a\u307e\u305b\u3093\u3002<\/h3>\n<p>  <\/p>\n<h3>PostgreSQL\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/h3>\n<pre><code class=\"language-shell\">root@localhost ~# yum -y localinstall https:\/\/download.postgresql.org\/pub\/repos\/yum\/10\/redhat\/rhel-7-x86_64\/pgdg-centos10-10-2.noarch.rpm  \n\nroot@localhost ~# yum -y install postgresql10-server\n\nroot@localhost ~# \/usr\/pgsql-10\/bin\/postgresql-10-setup initdb\n# \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u521d\u671f\u5316\u3092\u884c\u3046   \n\nroot@localhost ~# systemctl enbale postgresql-10  \nroot@localhost ~# systemctl start postgresql-10\n\n-------------------------------------------------------------------------------------------------------------------------------------------------\n\n#\u3000\u4e07\u304c\u4e00firewalld\u3068SELinux \u3092\u5916\u3057\u3066\u3044\u306a\u3044\u5834\u5408\u5916\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046  \n\nroot@localhost ~# systemctl disable firewalld\n\nroot@localhost ~# vi \/etc\/sysconfig\/seliux\n# This file controls the state of SELinux on the system.\n# SELINUX= can take one of these three values:\n#     enforcing - SELinux security policy is enforced.\n#     permissive - SELinux prints warnings instead of enforcing.\n#     disabled - No SELinux policy is loaded.\nSELINUX=disabled    \u2190\u3053\u3053\u3092disabled\u306b\u5909\u66f4\u3059\u308b\n# SELINUXTYPE= can take one of three values:\n#     targeted - Targeted processes are protected,\n#     minimum - Modification of targeted policy. Only selected processes are protected.\n#     mls - Multi Level Security protection.\nSELINUXTYPE=targeted  \n<\/code><\/pre>\n<p>\u6b21\u306b\u3001postgresql\u3078flyway\u304c\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068\u304d\u30c7\u30d5\u30a9\u30eb\u30c8\u306econf\u72b6\u614b\u3060\u3068\u5f3e\u304b\u308c\u3066\u3057\u307e\u3046\u306e\u3067\u30a2\u30af\u30bb\u30b9\u6a29\u9650\u3092\u4e0e\u3048\u3066\u3084\u308a\u307e\u3059\u3002  <\/p>\n<pre><code class=\"language-shell\">root@localhost ~# vi \/var\/lib\/pgsql\/10\/data\/pg_hba.conf  \n\n\u5f8c\u308d\u306e\u65b9\n# TYPE  DATABASE        USER            ADDRESS                 METHOD\n\n# &quot;local&quot; is for Unix domain socket connections only\nlocal   all             all                                     peer\n# IPv4 local connections:\nhost    all             all             127.0.0.1\/32            trust   \u2190trust\u306b\u5909\u66f4\n# IPv6 local connections:\nhost    all             all             ::1\/128                 ident\n# Allow replication connections from localhost, by a user with the\n# replication privilege.\nlocal   replication     all                                     peer\nhost    replication     all             127.0.0.1\/32            ident\nhost    replication     all             ::1\/128                 ident\n<\/code><\/pre>\n<h3>\u3067\u306f\u3001\u3044\u3088\u3044\u3088flyway\u3092\u843d\u3068\u3057\u3066\u304d\u307e\u3057\u3087\u3046<\/h3>\n<pre><code class=\"language-shell\">root@localhost ~# curl -O https:\/\/repo1.maven.org\/maven2\/org\/flywaydb\/flyway-commandline\/5.2.4\/flyway-commandline-5.2.4-linux-x64.tar.gz  \n\n\u4e00\u5fdc\u3001\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3067\u304d\u308b\u3068\u306f\u601d\u3046\u306e\u3067\u3059\u304c\u51fa\u6765\u306a\u3044\u5834\u5408\u306f\u304a\u3068\u306a\u3057\u304fwinscp\u304b\u4f55\u304b\u3067zip\u3092\u79fb\u52d5\u3055\u305b\u3068\u304d\u307e\u3057\u3087\u3046\u3002<\/code><\/pre>\n<pre><code class=\"language-shell\">root@localhost ~# tar xzvf flyway-commandline-5.2.4-linux-x64.tar.gz  \n\nroot@localhost ~# cd lyway-5.2.4\n\nREADME.txt  conf  drivers  flyway  flyway.cmd  jars  jre  lib  licenses  sql\n<\/code><\/pre>\n<p>\u3053\u3053\u307e\u3067\u78ba\u8a8d\u3067\u304d\u305f\u3089\u3001flyway\u3067postgresql\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u305f\u3081\u306bconf\u3092\u66f8\u3044\u3066\u3044\u304d\u307e\u3059\u3002  <\/p>\n<pre><code class=\"language-shell\">root@localhost ~# vi \/root\/lyway-5.2.4\/conf\/flyway.conf\n\n# JDBC url to use to connect to the database\n# Examples\n# --------\n# Most drivers are included out of the box.\n# * = JDBC driver must be downloaded and installed in \/drivers manually\n# ** = TNS_ADMIN environment variable must point to the directory of where tnsnames.ora resides\n# Aurora MySQL      : jdbc:mysql:\/\/&lt;instance&gt;.&lt;region&gt;.rds.amazonaws.com:&lt;port&gt;\/&lt;database&gt;?&lt;key1&gt;=&lt;value1&gt;&amp;&lt;key2&gt;=&lt;value2&gt;...\n# Aurora PostgreSQL : jdbc:postgresql:\/\/&lt;instance&gt;.&lt;region&gt;.rds.amazonaws.com:&lt;port&gt;\/&lt;database&gt;?&lt;key1&gt;=&lt;value1&gt;&amp;&lt;key2&gt;=&lt;value2&gt;...\n# CockroachDB       : jdbc:postgresql:\/\/&lt;host&gt;:&lt;port&gt;\/&lt;database&gt;?&lt;key1&gt;=&lt;value1&gt;&amp;&lt;key2&gt;=&lt;value2&gt;...\n# DB2*              : jdbc:db2:\/\/&lt;host&gt;:&lt;port&gt;\/&lt;database&gt;\n# Derby             : jdbc:derby:&lt;subsubprotocol&gt;:&lt;database&gt;&lt;;attribute=value&gt;\n# H2                : jdbc:h2:&lt;file&gt;\n# HSQLDB            : jdbc:hsqldb:file:&lt;file&gt;\n# Informix*         : jdbc:informix-sqli:\/\/&lt;host&gt;:&lt;port&gt;\/&lt;database&gt;:informixserver=dev\n# MariaDB           : jdbc:mariadb:\/\/&lt;host&gt;:&lt;port&gt;\/&lt;database&gt;?&lt;key1&gt;=&lt;value1&gt;&amp;&lt;key2&gt;=&lt;value2&gt;...\n# MySQL             : jdbc:mysql:\/\/&lt;host&gt;:&lt;port&gt;\/&lt;database&gt;?&lt;key1&gt;=&lt;value1&gt;&amp;&lt;key2&gt;=&lt;value2&gt;...\n# Oracle*           : jdbc:oracle:thin:@\/\/&lt;host&gt;:&lt;port&gt;\/&lt;service&gt;\n# Oracle* (TNS)**   : jdbc:oracle:thin:@&lt;tns_entry&gt;\n# PostgreSQL        : jdbc:postgresql:\/\/&lt;host&gt;:&lt;port&gt;\/&lt;database&gt;?&lt;key1&gt;=&lt;value1&gt;&amp;&lt;key2&gt;=&lt;value2&gt;...\n# SAP HANA*         : jdbc:sap:\/\/&lt;host&gt;:&lt;port&gt;\/?databaseName=&lt;database&gt;\n# SQL Server        : jdbc:sqlserver:\/\/\/\/&lt;host&gt;:&lt;port&gt;;databaseName=&lt;database&gt;\n# SQLite            : jdbc:sqlite:&lt;database&gt;\n# Sybase ASE        : jdbc:jtds:sybase:\/\/&lt;host&gt;:&lt;port&gt;\/&lt;database&gt;\n# Redshift*         : jdbc:redshift:\/\/&lt;host&gt;:&lt;port&gt;\/&lt;database&gt;\nflyway.url=jdbc:postgresql:\/\/localhost\/flysample  \u2190\u8ffd\u8a18\n\n# Fully qualified classname of the JDBC driver (autodetected by default based on flyway.url)\n# flyway.driver=\n\n# User to use to connect to the database. Flyway will prompt you to enter it if not specified.\n   flyway.user=postgres\u3000\u2190\u8ffd\u8a18 (postgres\u3078\u30ed\u30b0\u30a4\u30f3\u3067\u304d\u308b\u30e6\u30fc\u30b6\u540d)\n\n# Password to use to connect to the database. Flyway will prompt you to enter it if not specified.\n   flyway.password=toor\u3000\u2190\u8ffd\u8a18 (postgres\u3078\u30ed\u30b0\u30a4\u30f3\u3067\u304d\u308b\u30e6\u30fc\u30b6\u306e\u30d1\u30b9\u30ef\u30fc\u30c9)  \n<\/code><\/pre>\n<p>\u4e0a\u8a18\u3067postgres\u3078\u306e\u30ed\u30b0\u30a4\u30f3\u3092\u884c\u3046\u30d1\u30b9\u30ef\u30fc\u30c9\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u306a\u3044\u3068\u3001\u30a2\u30af\u30bb\u30b9\u304c\u51fa\u6765\u306a\u3044\u305f\u3081postgresql\u5074\u3067\u3082\u8a2d\u5b9a\u3092\u884c\u3044\u307e\u3059\u3002  <\/p>\n<pre><code class=\"language-shell\">root@localhost ~# su - postgres\n-bash-4.2$ psql\n\npsql (10.7)\n&quot;help&quot; \u3067\u30d8\u30eb\u30d7\u3092\u8868\u793a\u3057\u307e\u3059\u3002\n\npostgres=# \\password postgres\n\u65b0\u3057\u3044\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044: \u3053\u3053\u306b\u65b0\u3057\u304f\u8a2d\u5b9a\u3059\u308b\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u5165\u308c\u308b\n\u3082\u3046\u4e00\u5ea6\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044:\u3000\u30d1\u30b9\u30ef\u30fc\u30c9\u518d\u5165\u529b\npostgres=#\n\n#\u3000\u6700\u521d\u4f55\u3082\u306a\u3044\u306e\u3067\u3068\u308a\u3042\u3048\u305a \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u4f5c\u3063\u3066\u304a\u304d\u307e\u3059\u3002  \npostgres=# create database flysample;\nCREATE DATABASE\n<\/code><\/pre>\n<p>\u3053\u3053\u307e\u3067\u3067\u3001\u3088\u3046\u3084\u304fFlyway\u304c\u52d5\u304f\u74b0\u5883\u304c\u3068\u3068\u306e\u3044\u307e\u3057\u305f\u3002<\/p>\n<h2>flyway\u3092\u4f7f\u3046\u305f\u3081\u306esql\u30d5\u30a1\u30a4\u30eb\u3092\u7528\u610f\u3059\u308b<\/h2>\n<p>Flyway\u3092\u5229\u7528\u3059\u308b\u969b\u306b\u3001sql\u30d5\u30a1\u30a4\u30eb\u306e\u547d\u540d\u898f\u5247\u304c\u3042\u308b\u306e\u3067\u4e00\u5fdc\u8f09\u305b\u3066\u304a\u304d\u307e\u3059\u3002  <\/p>\n<blockquote>\n<p>\u982d\u306e\u300cV\u300d\u306f\u56fa\u5b9a\u3067\u3001\u305d\u306e\u5f8c\u306e\u6570\u5024\u304c\u30d0\u30fc\u30b8\u30e7\u30f3\u756a\u53f7\u3092\u8868\u3057\u307e\u3059\u3002\u305d\u306e\u5f8c\u306b_\u3092\uff12\u3064\u7d9a\u3051\u307e\u3059\u3002\u3055\u3089\u306b\u305d\u306e\u5f8c\u308d\u306fDescription\u3068\u306a\u308a\u3001<br \/>\n\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u5b9f\u884c\u30ed\u30b0(flyway info\u5b9f\u884c\u6642\u306b\u78ba\u8a8d\u3067\u304d\u308b)\u306b\u8a18\u9332\u3055\u308c\u307e\u3059\u3002<\/p>\n<\/blockquote>\n<p>\u3068\u3044\u3046\u3053\u3068\u306a\u306e\u3067\u3001\u4f5c\u3063\u3066\u3044\u304d\u307e\u3059\u3002  <\/p>\n<p>V1__create_db.sql<\/p>\n<pre><code class=\"language-sql\">create table flysample (\n    ID int not null,\n    NAME varchar(100) not null\n);<\/code><\/pre>\n<p>\u5185\u5bb9\u3068\u3057\u3066\u306f\u3001flysample \u3068\u3044\u3046\u30c6\u30fc\u30d6\u30eb\u3092\u4f5c\u3063\u3066\u30ab\u30e9\u30e0\u306fID\u3068NAME\u3068\u3044\u3046\u30ab\u30e9\u30e0\u3092\u4f5c\u308b\u3068\u3044\u3046\u3082\u306e\u306b\u306a\u308a\u307e\u3059\u3002  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/user-images.githubusercontent.com\/23439178\/53857345-2f186a00-4019-11e9-8902-193b01085b61.png\" alt=\"default\" \/><\/p>\n<p>\u3053\u3093\u306a\u611f\u3058\u306b\u306a\u308c\u3070ok\u3067\u3059\u3002<\/p>\n<p>\u6b21\u306b\u3001V2__insert.sql<\/p>\n<pre><code class=\"language-sql\">insert into flysample (ID, NAME) values (1, &#039;Keihin_1&#039;);\ninsert into flysample (ID, NAME) values (2, &#039;Keihin_2&#039;);\ninsert into flysample (ID, NAME) values (3, &#039;UT_SS_Takasaki_1&#039;);\ninsert into flysample (ID, NAME) values (4, &#039;UT_SS_Takasaki_2&#039;);\ninsert into flysample (ID, NAME) values (5, &#039;Kamotsu_1&#039;);\ninsert into flysample (ID, NAME) values (6, &#039;UT_SS_Utsunomiya_1&#039;);\ninsert into flysample (ID, NAME) values (7, &#039;UT_SS_Utsunomiya_2&#039;);\ninsert into flysample (ID, NAME) values (8, &#039;Kamotsu_2&#039;);\ninsert into flysample (ID, NAME) values (9, &#039;UT_for_Takasaki&#039;);\ninsert into flysample (ID, NAME) values (10, &#039;UT_for_Utsunomiya&#039;);\ninsert into flysample (ID, NAME) values (11, &#039;HigashiOmiya_RyuUchi&#039;);<\/code><\/pre>\n<p>\u3048\u3047\u3001\u30c7\u30fc\u30bf\u4f55\u5165\u308c\u3088\u3046\u304b\u306a\u30fc\u3068\u8ff7\u3063\u305f\u7d50\u679c\u30d0\u30a4\u30c8\u5148\u306e\u5927\u5bae\u99c5\u306e\u30db\u30fc\u30e0\u60c5\u5831\u3067\u3082\u5165\u308c\u3068\u3053\u30fc\u3068\u3044\u3046\u3053\u3068\u3067\u5165\u308c\u3066\u307f\u307e\u3057\u305f\u3002\u57fc\u4eac\u7dda\u304c\u306a\u3044\u306e\u306f\u5730\u4e0b\u30db\u30fc\u30e0\u3060\u3057\u3001\u3053\u308c\u4ee5\u4e0a\u4f5c\u308b\u306e\u304c\u9762\u5012\u3060\u3063\u305f\u304b\u3089<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/user-images.githubusercontent.com\/23439178\/53857663-7a7f4800-401a-11e9-9577-5715ea66ae48.png\" alt=\"default\" \/><\/p>\n<p>\u3067\u306f\u3001\u6b21\u3067\u3059\u3002<br \/>\nV3__correction.sql \u30d5\u30a1\u30a4\u30eb\u540d\u306ecorrection\u3068\u3044\u3046\u306e\u306f&quot;\u8a02\u6b63&quot;\u3068\u3044\u3046\u610f\u5473\u3067\u3059\u3002  <\/p>\n<pre><code class=\"language-sql\">alter table flysample rename id to TrackNumber;<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/user-images.githubusercontent.com\/23439178\/53857917-6c7df700-401b-11e9-9d32-7d80f75d5eca.png\" alt=\"default\" \/><\/p>\n<p>\u30c6\u30fc\u30d6\u30eb\u5185\u3067\u5148\u307b\u3069ID , NAME\u3068\u3044\u3046\u30ab\u30e9\u30e0\u3092\u4f5c\u308a\u307e\u3057\u305f\u304cID \u2192 tracknumber\u306b\u30ab\u30e9\u30e0\u540d\u3092\u5909\u66f4\u3057\u3066\u304a\u308a\u307e\u3059\u3002  <\/p>\n<p>\u3055\u3089\u306b\u3001\u884c\u304d\u307e\u3057\u3087\u3046\u3002<br \/>\nV4__create_mistakcolumn.sql \u30ab\u30e9\u30e0\u3092\u9593\u9055\u3048\u3066\u4f5c\u3063\u305fsql\u3067\u3059\u3002  <\/p>\n<pre><code class=\"language-sql\">alter table flysample add OfficePassword_Misstake int;<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/user-images.githubusercontent.com\/23439178\/53857820-08f3c980-401b-11e9-8d7e-439903bec929.png\" alt=\"default\" \/><\/p>\n<p>\u307e\u3093\u307e\u3067\u3059\u306d\u3001flysample\u3068\u3044\u3046\u30c6\u30fc\u30d6\u30eb\u306b\u3001officepassword_mistake\u3068\u3044\u3046\u30ab\u30e9\u30e0\u3092\u4f5c\u3063\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u3002  <\/p>\n<p>\u3067\u306f\u3001\u524d\u8ff0\u3067\u9593\u9055\u3048\u3066\u30ab\u30e9\u30e0\u3092\u4f5c\u3063\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u306e\u3067\u6d88\u3057\u307e\u3059\u3002<br \/>\nV5__drop_mistakecolumn.sql<\/p>\n<pre><code class=\"language-sql\">alter table flysample drop column officepassword_misstake;<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/user-images.githubusercontent.com\/23439178\/53858054-e2825e00-401b-11e9-86af-309b35a7ff8c.png\" alt=\"default\" \/><\/p>\n<p>\u6b21\u306b\u3001descripttion\u3068\u3044\u3046\u30ab\u30e9\u30e0\u3092\u4f5c\u308a\u307e\u3059\u3002<br \/>\nV6__create_descriptioncolumn.sql<\/p>\n<pre><code class=\"language-sql\">alter table flysample add descripttion varchar(1034) ;<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/user-images.githubusercontent.com\/23439178\/53858335-190ca880-401d-11e9-8c52-faa8d815ff8c.png\" alt=\"default\" \/><\/p>\n<p>\u524d\u8ff0\u3068\u540c\u3058\u3067\u3059\u3002flysample\u3068\u3044\u3046\u30c6\u30fc\u30d6\u30eb\u306bdescription\u3068\u3044\u3046\u30ab\u30e9\u30e0\u3092\u8ffd\u52a0\u3057\u307e\u3057\u305f\u3002<br \/>\n\u578b\u306fvarchar\u306e(1034)\u3067\u3059\u3002  <\/p>\n<p>\u3067\u306f\u3044\u3088\u3044\u3088\u6700\u7d42\u30d5\u30a7\u30fc\u30ba\u3078\u7a81\u5165\u3067\u3059\u3002<br \/>\nV7__update_insertdata.sql  <\/p>\n<pre><code class=\"language-sql\">UPDATE flysample SET description = &#039;\u4eac\u6d5c\u6771\u5317 \u5357\u884c 1\u756a&#039; WHERE tracknumber=&#039;1&#039;;\nUPDATE flysample SET description = &#039;\u4eac\u6d5c\u6771\u5317 \u5357\u884c 2\u756a&#039; WHERE tracknumber=&#039;2&#039;;\nUPDATE flysample SET description = &#039;\u4e0a\u91ce\u6771\u4eac\u30e9\u30a4\u30f3&amp;\u6e58\u5357\u65b0\u5bbf\u30e9\u30a4\u30f3 \u9ad8\u5d0e\u7dda\u9032\u5165 3\u756a&#039; WHERE tracknumber=&#039;3&#039;;\nUPDATE flysample SET description = &#039;\u4e0a\u91ce\u6771\u4eac\u30e9\u30a4\u30f3&amp;\u6e58\u5357\u65b0\u5bbf\u30e9\u30a4\u30f3 \u9ad8\u5d0e\u7dda\u9032\u5165 4\u756a&#039; WHERE tracknumber=&#039;4&#039;;\nUPDATE flysample SET description = &#039;\u8ca8\u7269\u7dda \u6e58\u5357\u65b0\u5bbf\u30e9\u30a4\u30f3\u76f4\u901a&#039; WHERE tracknumber=&#039;5&#039;;<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/user-images.githubusercontent.com\/23439178\/53858467-acde7480-401d-11e9-803c-7c3fb5d2c39a.png\" alt=\"default\" \/><\/p>\n<p>trucknumber\u3067update\u3059\u308b\u884c\u3092\u6307\u5b9a\u3057\u3001set description\u3067update\u3059\u308b\u9805\u76ee\u3092\u6307\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\n  <\/p>\n<p>V8__new_database_migration.sql<br \/>\npostgresql\u306f\u30ab\u30e9\u30e0\u3092\u8ffd\u52a0\u3059\u308b\u3068\u304d\u306b\u3001\u4efb\u610f\u306e\u884c\u306b\u30ab\u30e9\u30e0\u3092\u8ffd\u52a0\u3059\u308b\u6a5f\u80fd\u3092\u6301\u3061\u5408\u308f\u305b\u3066\u3044\u307e\u305b\u3093\u3002<br \/>\n\u3088\u3063\u3066\u3001\u30ab\u30e9\u30e0\u3092\u4efb\u610f\u306e\u884c\u306b\u8ffd\u52a0\u3059\u308b\u3068\u304d\u306f\u65b0\u3057\u304f\u30c6\u30fc\u30d6\u30eb\u3092\u4f5c\u3063\u3066\u65b0\u3057\u3044\u30c6\u30fc\u30d6\u30eb\u306b\u30c7\u30fc\u30bf\u3092\u3059\u3079\u3066\u79fb\u3057\u66ff\u3048\u306a\u304f\u3066\u306f\u3044\u3051\u307e\u305b\u3093\u3002<br \/>\n\u307e\u305f\u3001\u3053\u3053\u3089\u3067\u8907\u96d1\u306b\u306a\u3063\u3066\u304d\u305f\u306e\u3067\u4eca\u4e00\u5ea6\u72b6\u6cc1\u3092\u6574\u7406\u3057\u307e\u3059\u3002<\/p>\n<ul>\n<li>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306fflysample\u3068\u3044\u3046\u540d\u79f0  <\/li>\n<li>\u307e\u305f\u3001flysample\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u4e2d\u306b\u4f5c\u3089\u308c\u3066\u3044\u308b\u30c6\u30fc\u30d6\u30eb\u540d\u79f0\u306fflysample \u3068 flysample2\u3067\u3042\u308b\u3002  <\/li>\n<li>\u4efb\u610f\u884c\u306b\u30ab\u30e9\u30e0\u3092\u8ffd\u52a0\u3057\u305f\u5834\u5408\u3092\u60f3\u5b9a\u3057\u3001\u65e7\u30c6\u30fc\u30d6\u30eb(flysample)\u304b\u3089\u65b0\u30c6\u30fc\u30d6\u30eb(flysample2)\u3078\u306e\u79fb\u884c\u3092\u884c\u3046\u3002  <\/li>\n<li>\u5404\u30ab\u30e9\u30e0\u3068\u30c7\u30fc\u30bf\u306e\u5185\u5bb9\u306f\u3001\u5225\u52e4\u52d9\u5148\u3067\u3042\u308bJR\u5927\u5bae\u99c5\u306e\u767a\u8eca\u756a\u7dda\u306b\u95a2\u9023\u3059\u308b\u3082\u306e\u3067\u3042\u308b\u305f\u3081\u5206\u304b\u308a\u306b\u304f\u3044\u3068\u306f\u601d\u3044\u307e\u3059\u304c\u3054\u627f\u77e5\u304a\u304d\u304f\u3060\u3055\u3044\u3002  <\/li>\n<\/ul>\n<pre><code class=\"language-sql\">CREATE TABLE flysample2 ( \n  tracknumber integer NOT NULL,\n  name varchar(100) NOT NULL,\n  password integer,\n  description varchar(1023)\n);<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/user-images.githubusercontent.com\/23439178\/53858757-ac92a900-401e-11e9-9c43-a19df863d88c.png\" alt=\"default\" \/><\/p>\n<p>\u3053\u306e\u3088\u3046\u306b\u3001\u65b0\u3057\u3044\u30c6\u30fc\u30d6\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<br \/>\n\u30c6\u30fc\u30d6\u30eb\u306e\u4e2d\u306b\u3042\u308b\u30ab\u30e9\u30e0\u306f\u3001tracknumber , name , pasword , description\u306e4\u3064\u3067\u3059\u3002<\/p>\n<p>\u6b21\u306b\u3001V9__new_database_insert_data.sql<\/p>\n<pre><code class=\"language-sql\">INSERT INTO flysample2 (tracknumber, name, description) SELECT tracknumber, name, description FROM flysample;<\/code><\/pre>\n<p>\u3068\u3046\u3044\u3046\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/user-images.githubusercontent.com\/23439178\/53859237-62122c00-4020-11e9-9a30-8b88b6104e8a.gif\" alt=\"default\" \/><\/p>\n<p>\u610f\u5473\u3068\u3057\u3066\u306f\u3001\u3053\u3093\u306a\u611f\u3058\u3067\u3057\u3087\u3046\u304b\u3002<br \/>\ninsert into \u3067 \u65b0\u30c6\u30fc\u30d6\u30eb(flysample2)\u3078\u30c7\u30fc\u30bf\u3092\u767b\u9332\u3057\u307e\u3059(\u767b\u9332\u5185\u5bb9 : tracknumber , name , description) \u3002<br \/>\n\u6b21\u306b\u3001select \u3067\u73fe\u5728\u306e\u30c6\u30fc\u30d6\u30eb(flysample)\u3000\u304b\u3089\u3000(from) \u5404\u30ab\u30e9\u30e0(tracknumber, name ,description)\u5185\u306e\u30c7\u30fc\u30bf\u3092\u9078\u629e\u3057 flysample2\u3067\u9078\u629e\u3057\u3066\u3044\u308b\u5404\u30ab\u30e9\u30e0\u306b\u3076\u3061\u8fbc\u3080 \u3068\u3044\u3046\u611f\u3058\u3067\u3059\u3002  (\u305f\u3076\u3093....)<\/p>\n<p>\n\u3053\u3053\u307e\u3067\u7d42\u308f\u308c\u3070\u4e00\u901a\u308a\u306e\u8981\u4ef6\u306f\u7d42\u3048\u3089\u308c\u305f\u306f\u305a\u306a\u306e\u3067\u3001\u5927\u4e08\u592b\u3060\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n\u307e\u305f\u3001\u30d0\u30fc\u30b8\u30e7\u30f3\u306b\u95a2\u3057\u3066\u3082Flyway\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306b\u8a18\u8f09\u3055\u308c\u3066\u3044\u308b\u30d0\u30fc\u30b8\u30e7\u30f3\u3067\u306e\u52d5\u4f5c\u3092\u78ba\u8a8d\u3057\u3066\u3044\u308b\u306e\u3067\u554f\u984c\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<h2>\u8aa4\u690d<\/h2>\n<p>V8__new_database_migration.sql \u5185\u3067\u4f7f\u7528\u3057\u3066\u3044\u308b\u753b\u50cf\u306e\u8aac\u660e\u306b\u8aa4\u690d\u304c\u3042\u308a\u307e\u3057\u305f\u3002  <\/p>\n<p>\u00d7\u3000\u3053\u3063\u3061\u306f\u30c7\u30fc\u30bf\u3092\u30c7\u30fc\u30bf\u3092\u5165\u308c\u308b\u7bb1\u3060\u3051\u4f5c\u3063\u3066\u3042\u308b\u72b6\u614b<br \/>\n\u25cb\u3000\u3053\u3063\u3061\u306f\u30c7\u30fc\u30bf\u3092\u5165\u308c\u308b\u7bb1\u3060\u3051\u4f5c\u3063\u3066\u3042\u308b\u72b6\u614b  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Flayway \u6700\u65b0\u30d0\u30fc\u30b8\u30e7\u30f3 Flyway-commandline-5.2.4 (\u63a8\u5968) flyway-commandline-6.0.0 (\u30d9\u30fc\u30bf) Postgraseql \u5bfe\u5fdc\u30d0\u30fc\u30b8\u30e7\u30f3 Postgresql 10&hellip; <span class=\"clear\"><\/span><a href=\"https:\/\/blog.yukiafronia.com\/?p=61\" class=\"more-link read-more\" rel=\"bookmark\"><span class=\"screen-reader-text\">DB\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u30c4\u30fc\u30eb Flyway<\/span><i class=\"fa fa-arrow-right\"><\/i> \u306e\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":62,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-61","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-1"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/blog.yukiafronia.com\/index.php?rest_route=\/wp\/v2\/posts\/61","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.yukiafronia.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.yukiafronia.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.yukiafronia.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.yukiafronia.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=61"}],"version-history":[{"count":1,"href":"https:\/\/blog.yukiafronia.com\/index.php?rest_route=\/wp\/v2\/posts\/61\/revisions"}],"predecessor-version":[{"id":63,"href":"https:\/\/blog.yukiafronia.com\/index.php?rest_route=\/wp\/v2\/posts\/61\/revisions\/63"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.yukiafronia.com\/index.php?rest_route=\/wp\/v2\/media\/62"}],"wp:attachment":[{"href":"https:\/\/blog.yukiafronia.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=61"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.yukiafronia.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=61"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.yukiafronia.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=61"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}