Datasets:

Modalities:
Image
Tags:
code
Libraries:
Datasets
License:
File size: 11,327 Bytes
a01128b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
<!DOCTYPE html>
<html>
 <head>
  <style>
   body {
    margin: 0 auto;
    max-width: 800px;
    padding: 1rem;
}

h1 a {
    color: #000;
    text-decoration: none;
}

h2 small {
    font-size: 0.6em;
    margin-left: 3rem;
}

p {
    line-height: 2rem;
}

img {
    max-width: 100%;
}

li {
    margin: 1rem 0;
}

ul.none {
    list-style: none;
    padding-left: 0;
}

small {
    color: grey;
}

code {
    background: #f1f1f1;
    font-size: 0.8rem;
    padding: 2px 2px;
}

.highlight {
    max-width: 100%;
}

.highlight pre {
    background-color: #f6f8fa;
    border-radius: 6px;
    padding: 1rem;
    white-space: pre-wrap;
    word-break: break-word;
}

pre code {
    background: transparent;
}

blockquote {
    color: dimgrey;
    font-style: italic;
    margin-left: 1rem;
    padding-left: 1em;
    box-shadow: #e1e1e1 3px 0 0 0 inset;
}

hr {
    margin: 1.5rem auto;
}

article footer {
    margin-top: 2rem;
}

footer#mastfoot {
    border-top: 1px solid lightgrey;
    margin: 2rem auto;
    padding: 1rem 0;
}

#callout {
    background: #e9f5db;
    padding: 1rem 2rem;
}

#callout blockquote {
    color: #010101;
}

/* syntax.css generated with:
   hugo gen chromastyles --style=github > syntax.css
   and imported
 */
/* Background */ .chroma { background-color: #ffffff }
/* Other */ .chroma .x {  }
/* Error */ .chroma .err { color: #a61717; background-color: #e3d2d2 }
/* LineTableTD */ .chroma .lntd { vertical-align: top; padding: 0; margin: 0; border: 0; }
/* LineTable */ .chroma .lntable { border-spacing: 0; padding: 0; margin: 0; border: 0; width: auto; overflow: auto; display: block; }
/* LineHighlight */ .chroma .hl { display: block; width: 100%;background-color: #ffffcc }
/* LineNumbersTable */ .chroma .lnt { margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f }
/* LineNumbers */ .chroma .ln { margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f }
/* Keyword */ .chroma .k { color: #000000; font-weight: bold }
/* KeywordConstant */ .chroma .kc { color: #000000; font-weight: bold }
/* KeywordDeclaration */ .chroma .kd { color: #000000; font-weight: bold }
/* KeywordNamespace */ .chroma .kn { color: #000000; font-weight: bold }
/* KeywordPseudo */ .chroma .kp { color: #000000; font-weight: bold }
/* KeywordReserved */ .chroma .kr { color: #000000; font-weight: bold }
/* KeywordType */ .chroma .kt { color: #445588; font-weight: bold }
/* Name */ .chroma .n {  }
/* NameAttribute */ .chroma .na { color: #008080 }
/* NameBuiltin */ .chroma .nb { color: #0086b3 }
/* NameBuiltinPseudo */ .chroma .bp { color: #999999 }
/* NameClass */ .chroma .nc { color: #445588; font-weight: bold }
/* NameConstant */ .chroma .no { color: #008080 }
/* NameDecorator */ .chroma .nd { color: #3c5d5d; font-weight: bold }
/* NameEntity */ .chroma .ni { color: #800080 }
/* NameException */ .chroma .ne { color: #990000; font-weight: bold }
/* NameFunction */ .chroma .nf { color: #990000; font-weight: bold }
/* NameFunctionMagic */ .chroma .fm {  }
/* NameLabel */ .chroma .nl { color: #990000; font-weight: bold }
/* NameNamespace */ .chroma .nn { color: #555555 }
/* NameOther */ .chroma .nx {  }
/* NameProperty */ .chroma .py {  }
/* NameTag */ .chroma .nt { color: #000080 }
/* NameVariable */ .chroma .nv { color: #008080 }
/* NameVariableClass */ .chroma .vc { color: #008080 }
/* NameVariableGlobal */ .chroma .vg { color: #008080 }
/* NameVariableInstance */ .chroma .vi { color: #008080 }
/* NameVariableMagic */ .chroma .vm {  }
/* Literal */ .chroma .l {  }
/* LiteralDate */ .chroma .ld {  }
/* LiteralString */ .chroma .s { color: #dd1144 }
/* LiteralStringAffix */ .chroma .sa { color: #dd1144 }
/* LiteralStringBacktick */ .chroma .sb { color: #dd1144 }
/* LiteralStringChar */ .chroma .sc { color: #dd1144 }
/* LiteralStringDelimiter */ .chroma .dl { color: #dd1144 }
/* LiteralStringDoc */ .chroma .sd { color: #dd1144 }
/* LiteralStringDouble */ .chroma .s2 { color: #dd1144 }
/* LiteralStringEscape */ .chroma .se { color: #dd1144 }
/* LiteralStringHeredoc */ .chroma .sh { color: #dd1144 }
/* LiteralStringInterpol */ .chroma .si { color: #dd1144 }
/* LiteralStringOther */ .chroma .sx { color: #dd1144 }
/* LiteralStringRegex */ .chroma .sr { color: #009926 }
/* LiteralStringSingle */ .chroma .s1 { color: #dd1144 }
/* LiteralStringSymbol */ .chroma .ss { color: #990073 }
/* LiteralNumber */ .chroma .m { color: #009999 }
/* LiteralNumberBin */ .chroma .mb { color: #009999 }
/* LiteralNumberFloat */ .chroma .mf { color: #009999 }
/* LiteralNumberHex */ .chroma .mh { color: #009999 }
/* LiteralNumberInteger */ .chroma .mi { color: #009999 }
/* LiteralNumberIntegerLong */ .chroma .il { color: #009999 }
/* LiteralNumberOct */ .chroma .mo { color: #009999 }
/* Operator */ .chroma .o { color: #000000; font-weight: bold }
/* OperatorWord */ .chroma .ow { color: #000000; font-weight: bold }
/* Punctuation */ .chroma .p {  }
/* Comment */ .chroma .c { color: #999988; font-style: italic }
/* CommentHashbang */ .chroma .ch { color: #999988; font-style: italic }
/* CommentMultiline */ .chroma .cm { color: #999988; font-style: italic }
/* CommentSingle */ .chroma .c1 { color: #999988; font-style: italic }
/* CommentSpecial */ .chroma .cs { color: #999999; font-weight: bold; font-style: italic }
/* CommentPreproc */ .chroma .cp { color: #999999; font-weight: bold; font-style: italic }
/* CommentPreprocFile */ .chroma .cpf { color: #999999; font-weight: bold; font-style: italic }
/* Generic */ .chroma .g {  }
/* GenericDeleted */ .chroma .gd { color: #000000; background-color: #ffdddd }
/* GenericEmph */ .chroma .ge { color: #000000; font-style: italic }
/* GenericError */ .chroma .gr { color: #aa0000 }
/* GenericHeading */ .chroma .gh { color: #999999 }
/* GenericInserted */ .chroma .gi { color: #000000; background-color: #ddffdd }
/* GenericOutput */ .chroma .go { color: #888888 }
/* GenericPrompt */ .chroma .gp { color: #555555 }
/* GenericStrong */ .chroma .gs { font-weight: bold }
/* GenericSubheading */ .chroma .gu { color: #aaaaaa }
/* GenericTraceback */ .chroma .gt { color: #aa0000 }
/* GenericUnderline */ .chroma .gl { text-decoration: underline }
/* TextWhitespace */ .chroma .w { color: #bbbbbb }
  </style>
  <meta charset="utf-8">
  <meta content="width=device-width,initial-scale=1" name="viewport">
  <meta content="interest-cohort=()" http-equiv="permissions-policy">
  <meta content="Running Liquibase against and existing database using LiquibaseServletListener | Tony Wolski" property="og:title">
  <meta content="I recently took on the task of integrating Liquibase into the project I&rsquo;m working on at work. I&rsquo;d played around with Liquibase before on small &hellip;" property="og:description">
  <meta content="" property="og:url">
  <meta content="Tony Wolski" property="og:site_name">
  <meta content="article" property="og:type">
  <meta content="summary" property="twitter:card">
  <title>
   Running Liquibase against and existing database using LiquibaseServletListener | Tony Wolski
  </title>
  <meta content="I recently took on the task of integrating Liquibase into the project I&rsquo;m working on at work. I&rsquo;d played around with Liquibase before on small &hellip;" name="description">
  <meta content="Tony Wolski" name="author">
  <meta content="IE=edge" http-equiv="x-ua-compatible">
  <meta content="no-referrer" name="referrer">
 </head>
 <body>
  <header id="masthead">
   <h1>
    <a title="Tony Wolski">
     Tony Wolski
    </a>
   </h1>
  </header>
  <main>
   <article class="post">
    <header>
     <h1>
      Running Liquibase against and existing database using LiquibaseServletListener
     </h1>
     <small>
      2013-10-14
     </small>
    </header>
    <p>
     I recently took on the task of integrating
     <a>
      Liquibase
     </a>
     into the project I&rsquo;m working on at work. I&rsquo;d played around with Liquibase before on small personal projects, but had never faced applying it to an existing, large and in-production database.
    </p>
    <p>
     I ran into a few problems when using the LiquibaseServletListener after having previously run changelogSync via the command line. Basically, Liquibase was trying to execute the changesets in my changelog files even though they had already been executed during changelogSync.
    </p>
    <p>
     I had executed Liquibase&rsquo;s changelogSync from the command line in the same directory as the file generated by generateChangeLog, something along these lines:
    </p>
    <div class="highlight">
     <pre class="chroma"><code class="language-shell" data-lang="shell">liquibase --driver<span class="o">=</span>com.mysql.jdbc.Driver <span class="se">\
</span><span class="se"></span>  --classpath<span class="o">=</span>mysql-connector-java-5.1.13-bin.jar <span class="se">\
</span><span class="se"></span>  --changeLogFile<span class="o">=</span>accounts-changelog-schema.xml <span class="se">\
</span><span class="se"></span>  --url<span class="o">=</span><span class="s2">"jdbc:mysql://localhost:3306/accounts"</span> <span class="se">\
</span><span class="se"></span>  --username<span class="o">=</span>user --password<span class="o">=</span>password changelogSync
</code></pre>
    </div>
    <p>
     Afterwards, the rows in Liquibase&rsquo;s DATABASECHANGELOG table indicated everything had worked, and each of the changesets had an EXECTYPE of EXECUTED, which should have meant when the servlet listener started up the changesets would be skipped over. But Liquibase was trying to execute the changesets and I was getting a log full of errors.
    </p>
    <p>
     Turns out that because I had defined my changelog file in a subdirectory:
    </p>
    <div class="highlight">
     <pre class="chroma"><code class="language-xml" data-lang="xml"><span class="nt">&lt;context-param&gt;</span>
  <span class="nt">&lt;param-name&gt;</span>liquibase.changelog<span class="nt">&lt;/param-name&gt;</span>
  <span class="nt">&lt;param-value&gt;</span>db/changelog/accounts-changelog-schema.xml<span class="nt">&lt;/param-value&gt;</span>
<span class="nt">&lt;/context-param&gt;</span>
</code></pre>
    </div>
    <p>
     And had run changelogSync from the same directory as the generated changelog (which meant the FILENAME field for each changeset was &lsquo;accounts-changelog-schema.xml&rsquo;), the FILENAME field didn&rsquo;t match. Hence Liquibase&rsquo;s attempts to re-run the changesets.
    </p>
    <p>
     Fixing the problem was simply a matter of updating the database
    </p>
    <div class="highlight">
     <pre class="chroma"><code class="language-sql" data-lang="sql"><span class="k">update</span> <span class="n">DATABASASECHANGELOG</span> <span class="k">set</span> <span class="n">FILENAME</span> <span class="o">=</span> <span class="s1">'db/changelog/accounts-changelog-schema.xml'</span><span class="p">;</span>
</code></pre>
    </div>
    <footer>
     &laquo;
     <a>
      Previous
     </a>
     ||
     <a>
      Next
     </a>
     &raquo;
    </footer>
    <br>
    <p>
     <strong>
      Your thoughts?
     </strong>
     I'd love to hear them. Please get in
     <a>
      contact
     </a>
     .
    </p>
   </article>
  </main>
  <footer id="mastfoot">
   <nav>
    <a title="Contact">
     Contact
    </a>
   </nav>
  </footer>
 </body>
</html>