First Steps: Command-line
This brief tutorial will teach how to get up and running with the Flyway Command-line tool. It will take you through the steps on how to configure it and how to write and execute your first few database migrations.
This tutorial should take you about 5 minutes to complete.
Downloading and extracting Flyway
Start by downloading the Flyway Command-line Tool for your platform and extract it.
Let’s jump into our new directory:
cd flyway-5.2.4
Configuring Flyway
Once that is done, configure Flyway by editing /conf/flyway.conf like this:
flyway.url=jdbc:h2:file:./foobardb
flyway.user=SA
flyway.password=
Creating the first migration
Now create a first migration in the /sql directory called V1__Create_person_table.sql:
create table PERSON (
ID int not null,
NAME varchar(100) not null
);
Migrating the database
It’s now time to execute Flyway to migrate your database:
flyway-5.2.4> flyway migrate
If all went well, you should see the following output:
Database: jdbc:h2:file:./foobardb (H2 1.4)
Successfully validated 1 migration (execution time 00:00.008s)
Creating Schema History table: "PUBLIC"."flyway_schema_history"
Current version of schema "PUBLIC": << Empty Schema >>
Migrating schema "PUBLIC" to version 1 - Create person table
Successfully applied 1 migration to schema "PUBLIC" (execution time 00:00.033s)
Adding a second migration
If you now add a second migration to the /sql directory called V2__Add_people.sql:
insert into PERSON (ID, NAME) values (1, 'Axel');
insert into PERSON (ID, NAME) values (2, 'Mr. Foo');
insert into PERSON (ID, NAME) values (3, 'Ms. Bar');
and execute it by issuing:
flyway-5.2.4> flyway migrate
You now get:
Database: jdbc:h2:file:./foobardb (H2 1.4)
Successfully validated 2 migrations (execution time 00:00.018s)
Current version of schema "PUBLIC": 1
Migrating schema "PUBLIC" to version 2 - Add people
Successfully applied 1 migration to schema "PUBLIC" (execution time 00:00.016s)
Summary
In this brief tutorial we saw how to:
- install the Flyway Command-line tool
- configure it so it can talk to our database
- write our first couple of migrations
These migrations were then successfully found and executed.
First Steps: Command-line的更多相关文章
- How to build .apk file from command line(转)
How to build .apk file from command line Created on Wednesday, 29 June 2011 14:32 If you don’t want ...
- Building Xcode iOS projects and creating *.ipa file from the command line
For our development process of iOS applications, we are using Jenkins set up on the Mac Mini Server, ...
- [笔记]The Linux command line
Notes on The Linux Command Line (by W. E. Shotts Jr.) edited by Gopher 感觉博客园是不是搞了什么CSS在里头--在博客园显示效果挺 ...
- 命令行command line 使用 http proxy的设置方法 Setting Up HTTP Proxy in Terminal
Step 1: Install Shadowsocks Client Shadowsocks is an open-source proxy project to help people visit ...
- Can't use Subversion command line client: svn Probably the path to Subversion executable is wrong. Fix it.
1.最近使用SVN工具时,Checkout出项目到本地后后,然后将其导入到Intellij idea中开发,在提交svn代码的时候,出现这样的错误:Can't use Subversion comma ...
- How to Use Android ADB Command Line Tool
Android Debug Bridge (adb) is a tool that lets you manage the state of an emulator instance or Andro ...
- Chrome-Console( Command Line API Reference)
来源于:https://developers.google.com/web/tools/chrome-devtools/console/command-line-reference The Comma ...
- logoff remote desktop sessions via command line tools
This trick I learned from my one of ex-college. In Windows servers, only two remote desktop session ...
- 使用intellij的svn时提示出错: Can't use Subversion command line client: svn.Errors found while svn working copies detection.
使用Intellij的svn时提示出错:Can't use Subversion command line client: svn. Errors found while svn working co ...
- ubuntu16.04安装virtualbox5.1失败 gcc:error:unrecognized command line option ‘-fstack-protector-strong’
系统:ubuntu16.04.1 软件:Virtualbox-5.1 编译器:GCC 4.7.4 在如上环境下安装Vbx5.1提示我在终端执行/sbin/vboxconfig命令 照做 出现如下err ...
随机推荐
- GCD (RMQ + 二分)
RMQ存的是区间GCD,然后遍历 i: 1->n, 然后不断地对[i, R]区间进行二分求以i为起点的相同gcd的区间范围,慢慢缩减区间. #include<bits/stdc++.h&g ...
- MySql语句分类
SQL语言分为四大类:数据定义语言DDL,数据查询语言DQL,数据操作语言DML,数据控制语言DCL [1]数据定义语言DDL 数据定义语言DDL,用于创建.修改.删除数据库内的数据结构.如下: (1 ...
- jQuery图片懒加载插件jquery.lazyload.js使用实例注意事项说明
jQuery图片懒加载插件jquery.lazyload.js使用实例注意事项说明 jquery.lazyload.js是一个用JavaScript编写的jQuery插件.它可以延迟加载长页面中的图片 ...
- [转载]drop、truncate和delete的区别
原文出处:http://blog.csdn.net/ws0513/article/details/49980547 (1)DELETE语句执行删除的过程是每次从表中删除一行,并且同时将该行的删除操作作 ...
- 不懂RPC实现原理怎能实现架构梦
RPC(Remote Procedure Call Protocol)——远程过程调用协议,它是一种通过网络从远程计算机程序上请求服务,而不需要了解底层网络技术的协议.RPC协议假定某些传输协议的存在 ...
- maven war工程重命名
1,按f2对项目进行改名 2,改变其web.xml 的项目名 3,org.eclipse.wst.common.component 改变其项目名
- 如何解决win10关机状态下,按键盘会自动开机的问题
关机状态下按下键盘会自动开机,是因为所装的系统默认设置了快速启动功能 下面是关闭快速启动的方法: 步骤一: 在win10桌面右击,点击显示设置 步骤二: 电源和睡眠-->其他电源设置 步骤三: ...
- getopt_long_only
st_i2c_parser.c中用到,遂学习一下: 参考:https://blog.csdn.net/pengrui18/article/details/8078813 https://blog.cs ...
- 注册页面的JSON响应方式详细分析(与前端页面交互方式之一)
控制器层 需求分析: 访问路径:`/user/reg.do` //自己根据功能需求设定的请求参数:`username=xx&password=xx&&phone=xx& ...
- Vim常用命令:移动 跳转 到 文档开头或末尾
gg:命令将光标移动到文档开头 G:命令将光标移动到文档末尾 vi编辑器中在命令行模式下输入G可以直接跳转到页面的底部 在命令行模式下输入1G可以跳转到页面的头部位置 更多在vi中移动编辑位置的命令说 ...