LoginSignup
0
0

More than 5 years have passed since last update.

flyway commnad line MySQL

Posted at

flywayをcommand lineで使う時の方法

公式見ればいいけど一応メモ
First steps: command line

手順

MySQLとjavaのインストールは済んでいるのが前提

  1. wget https://repo1.maven.org/maven2/org/flywaydb/flyway-commandline/4.1.2/flyway-commandline-4.1.2-windows-x64.zip
  2. unzip flyway-commandline-4.1.2-windows-x64.zip
  3. cd flyway-4.1.2/
  4. vim conf/flyway.conf
  5. vim sql/V1__Create_person_table.sql
  6. ./flyway migrate

4の中身

接続設定を追記

flyway.url=jdbc:mysql://localhost/your_db_name
flyway.user=your_user_name
flyway.password=your_password

5の中身

実際にテーブルを作成していくときのSQL文

create table PERSON (
    ID int not null,
    NAME varchar(100) not null
);

6まで実行することでMySQLにPERSONテーブルが作成されます
新しい変更やテーブル追加をしたい場合はもう一度./flyway migrateを実行

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0