/
validate.html
231 lines (220 loc) · 8.59 KB
/
validate.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
---
layout: commandLine
pill: validate
subtitle: 'Command-line: validate'
---
<div id="commandLineValidate">
<h1>Command-line: validate</h1>
<p>Validates the applied migrations against the ones available on the classpath. The build fails if differences in
migration names, types or checksums are found. <br/></p>
<a href="/documentation/command/validate"><img src="/assets/balsamiq/command-validate.png" alt="validate"></a>
<h2>Usage</h2>
<pre class="console">> flyway [options] validate</pre>
<h2>Options</h2>
<table class="table table-bordered table-hover">
<thead>
<tr>
<th>Option</th>
<th>Required</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>url</td>
<td>YES</td>
<td></td>
<td>The jdbc url to use to connect to the database</td>
</tr>
<tr>
<td>driver</td>
<td>NO</td>
<td><i>Auto-detected based on url</i></td>
<td>The fully qualified classname of the jdbc driver to use
to connect to the database
</td>
</tr>
<tr>
<td>user</td>
<td>NO</td>
<td></td>
<td>The user to use to connect to the database</td>
</tr>
<tr>
<td>password</td>
<td>NO</td>
<td></td>
<td>The password to use to connect to the database</td>
</tr>
<tr>
<td>schemas</td>
<td>NO</td>
<td><i>default schema of the connection</i></td>
<td>Comma-separated case-sensitive list of schemas managed by Flyway.<br/>
The first schema will be the one containing the metadata table.
</td>
</tr>
<tr>
<td>table</td>
<td>NO</td>
<td>schema_version</td>
<td>The name of Flyway's metadata table.<br/>By
default (single-schema mode) the metadata table is placed in the default schema for the connection
provided by the datasource.<br/>When the <i>flyway.schemas</i> property is set (multi-schema mode),
the metadata table is placed in the first schema of the list.
</td>
</tr>
<tr id="locations">
<td>locations</td>
<td>NO</td>
<td><nobr>filesystem:<i><install-dir></i>/sql</nobr></td>
<td>Comma-separated list of locations to scan recursively for migrations. The location type is determined by its prefix.<br/>
Unprefixed locations or locations starting with <code>classpath:</code> point to a package on the classpath and may contain both sql and java-based migrations.<br/>
Locations starting with <code>filesystem:</code> point to a directory on the filesystem and may only contain sql migrations.
</td>
</tr>
<tr id="jarDirs">
<td>jarDirs</td>
<td>NO</td>
<td><nobr><i><install-dir></i>/jars</nobr></td>
<td>Comma-separated list of directories containing JDBC drivers and Java-based migrations</td>
</tr>
<tr>
<td>sqlMigrationPrefix</td>
<td>NO</td>
<td>V</td>
<td>The file name prefix for Sql migrations</td>
</tr>
<tr>
<td>repeatableSqlMigrationPrefix</td>
<td>NO</td>
<td>R</td>
<td>The file name prefix for repeatable Sql migrations</td>
</tr>
<tr>
<td>sqlMigrationSeparator</td>
<td>NO</td>
<td>__</td>
<td>The file name separator for Sql migrations</td>
</tr>
<tr>
<td>sqlMigrationSuffix</td>
<td>NO</td>
<td>.sql</td>
<td>The file name suffix for Sql migrations</td>
</tr>
<tr>
<td>encoding</td>
<td>NO</td>
<td>UTF-8</td>
<td>The encoding of Sql migrations</td>
</tr>
<tr>
<td>placeholderReplacement</td>
<td>NO</td>
<td>true</td>
<td>Whether placeholders should be replaced</td>
</tr>
<tr>
<td>placeholders.<i>name</i></td>
<td>NO</td>
<td></td>
<td>Placeholders to replace in Sql migrations</td>
</tr>
<tr>
<td>placeholderPrefix</td>
<td>NO</td>
<td>${</td>
<td>The prefix of every placeholder</td>
</tr>
<tr>
<td>placeholderSuffix</td>
<td>NO</td>
<td>}</td>
<td>The suffix of every placeholder</td>
</tr>
<tr>
<td>resolvers</td>
<td>NO</td>
<td></td>
<td>Comma-separated list of fully qualified class names of custom
<a href="/documentation/api/javadoc/org/flywaydb/core/api/resolver/MigrationResolver">MigrationResolver</a>
implementations to be used in addition to the built-in ones for resolving Migrations to apply.</td>
</tr>
<tr>
<td>callbacks</td>
<td>NO</td>
<td></td>
<td>Comma-separated list of fully qualified class names of
<a href="/documentation/api/javadoc/org/flywaydb/core/api/callback/FlywayCallback">FlywayCallback</a>
implementations to use to hook into the Flyway lifecycle.</td>
</tr>
<tr>
<td>skipDefaultCallbacks</td>
<td>NO</td>
<td>false</td>
<td>Whether default built-in callbacks (sql) should be skipped. If true, only custom callbacks are used.</td>
</tr>
<tr>
<td>target</td>
<td>NO</td>
<td><i>latest version</i></td>
<td>The target version up to which Flyway should consider migrations. Migrations with a higher version number will be ignored. The special value <code>current</code> designates the current version of the schema.
</td>
</tr>
<tr>
<td>outOfOrder</td>
<td>NO</td>
<td>false</td>
<td>Allows migrations to be run "out of order".
<p>If you already have versions 1 and 3 applied, and now a version 2 is found,
it will be applied too instead of being ignored.</p>
</td>
</tr>
<tr>
<td>cleanOnValidationError</td>
<td>NO</td>
<td>false</td>
<td>Whether to automatically call clean or not when a validation error occurs.<br/><br/>
This is exclusively intended as a convenience for development. Even tough we
strongly recommend not to change migration scripts once they have been checked into SCM and run, this
provides a way of dealing with this case in a smooth manner. The database will be wiped clean
automatically, ensuring that the next migration will bring you back to the state checked into
SCM.<br/><br/><strong>Warning ! Do not enable in production !</strong>
</td>
</tr>
</tbody>
</table>
<h2>Sample configuration</h2><pre
class="prettyprint">flyway.driver=org.hsqldb.jdbcDriver
flyway.url=jdbc:hsqldb:file:/db/flyway_sample
flyway.user=SA
flyway.password=mySecretPwd
flyway.schemas=schema1,schema2,schema3
flyway.table=schema_history
flyway.locations=classpath:com.mycomp.migration,database/migrations,filesystem:/sql-migrations
flyway.sqlMigrationPrefix=Migration-
flyway.repeatableSqlMigrationPrefix=RRR
flyway.sqlMigrationSeparator=__
flyway.sqlMigrationSuffix=-OK.sql
flyway.encoding=ISO-8859-1
flyway.placeholderReplacement=true
flyway.placeholders.aplaceholder=value
flyway.placeholders.otherplaceholder=value123
flyway.placeholderPrefix=#[
flyway.placeholderSuffix=]
flyway.resolvers=com.mycomp.project.CustomResolver,com.mycomp.project.AnotherResolver
flyway.callbacks=com.mycomp.project.CustomCallback,com.mycomp.project.AnotherCallback
flyway.skipDefaultCallbacks=false
flyway.target=5.1
flyway.outOfOrder=false
flyway.cleanOnValidationError=false</pre>
<h2>Sample output</h2>
<pre class="console">> flyway validate
Flyway {{ site.flywayVersion }} by Boxfuse
No migrations applied yet. No validation necessary.</pre>
<p class="next-steps">
<a class="btn btn-primary" href="/documentation/commandline/baseline">Command-line: baseline <i class="fa fa-arrow-right"></i></a>
</p>
</div>