|
10 | 10 | <meta property="og:title" content="sqldef"> |
11 | 11 | <meta property="og:description" content="Idempotent schema management for MySQL, PostgreSQL, SQLite, and SQL Server"> |
12 | 12 | <meta property="og:image" content="https://sqldef.github.io/sqldef512.png"> |
13 | | - |
| 13 | + |
14 | 14 | <link rel="icon" type="image/png" sizes="128x128" href="sqldef128.png"> |
15 | 15 | <link rel="icon" type="image/png" sizes="256x256" href="sqldef256.png"> |
16 | 16 | <link rel="icon" type="image/png" sizes="512x512" href="sqldef512.png"> |
@@ -156,13 +156,13 @@ <h4 class="schema-header">Desired schema</h4> |
156 | 156 | </div> |
157 | 157 |
|
158 | 158 | <script> |
159 | | - const dbType = document.getElementById('dbType') |
160 | | - const inputA = document.getElementById('inputA') |
161 | | - const inputB = document.getElementById('inputB') |
162 | | - const outputUp = document.getElementById('outputUp') |
163 | | - const errorUp = document.getElementById('errorUp') |
164 | | - const outputDown = document.getElementById('outputDown') |
165 | | - const errorDown = document.getElementById('errorDown') |
| 159 | + const dbType = document.getElementById('dbType'); |
| 160 | + const inputA = document.getElementById('inputA'); |
| 161 | + const inputB = document.getElementById('inputB'); |
| 162 | + const outputUp = document.getElementById('outputUp'); |
| 163 | + const errorUp = document.getElementById('errorUp'); |
| 164 | + const outputDown = document.getElementById('outputDown'); |
| 165 | + const errorDown = document.getElementById('errorDown'); |
166 | 166 |
|
167 | 167 | const schemaExamples = { |
168 | 168 | mysql: { |
@@ -208,49 +208,49 @@ <h4 class="schema-header">Desired schema</h4> |
208 | 208 | name NVARCHAR(128) DEFAULT 'konsumer', |
209 | 209 | created_at DATETIME NOT NULL |
210 | 210 | );` |
211 | | - } |
212 | | - } |
| 211 | + }, |
| 212 | + }; |
213 | 213 |
|
214 | 214 | async function runDiff() { |
215 | | - // Run up diff (current -> desired) |
216 | | - outputUp.style.display = 'none' |
217 | | - errorUp.style.display = 'none' |
218 | | - try { |
219 | | - const result = await window.sqldef(dbType.value, inputB.value, inputA.value) |
220 | | - outputUp.innerHTML = result |
221 | | - outputUp.style.display = 'block' |
222 | | - } catch (e) { |
223 | | - errorUp.style.display = 'block' |
224 | | - errorUp.innerHTML = e.message |
225 | | - } |
| 215 | + // Run up diff (current -> desired) |
| 216 | + outputUp.style.display = 'none'; |
| 217 | + errorUp.style.display = 'none'; |
| 218 | + try { |
| 219 | + const result = await window.sqldef(dbType.value, inputB.value, inputA.value); |
| 220 | + outputUp.innerHTML = result; |
| 221 | + outputUp.style.display = 'block'; |
| 222 | + } catch (e) { |
| 223 | + errorUp.style.display = 'block'; |
| 224 | + errorUp.innerHTML = e.message; |
| 225 | + } |
226 | 226 |
|
227 | 227 | // Run down diff (desired -> current) |
228 | | - outputDown.style.display = 'none' |
229 | | - errorDown.style.display = 'none' |
| 228 | + outputDown.style.display = 'none'; |
| 229 | + errorDown.style.display = 'none'; |
230 | 230 | try { |
231 | | - const result = await window.sqldef(dbType.value, inputA.value, inputB.value) |
232 | | - outputDown.innerHTML = result |
233 | | - outputDown.style.display = 'block' |
| 231 | + const result = await window.sqldef(dbType.value, inputA.value, inputB.value); |
| 232 | + outputDown.innerHTML = result; |
| 233 | + outputDown.style.display = 'block'; |
234 | 234 | } catch (e) { |
235 | | - errorDown.style.display = 'block' |
236 | | - errorDown.innerHTML = e.message |
| 235 | + errorDown.style.display = 'block'; |
| 236 | + errorDown.innerHTML = e.message; |
237 | 237 | } |
238 | 238 | } |
239 | 239 |
|
240 | 240 | dbType.addEventListener('change', () => { |
241 | | - const examples = schemaExamples[dbType.value] |
242 | | - if (examples) { |
243 | | - inputA.value = examples.current |
244 | | - inputB.value = examples.desired |
245 | | - } |
246 | | - runDiff() |
247 | | - }) |
| 241 | + const examples = schemaExamples[dbType.value]; |
| 242 | + if (examples) { |
| 243 | + inputA.value = examples.current; |
| 244 | + inputB.value = examples.desired; |
| 245 | + } |
| 246 | + runDiff(); |
| 247 | + }) |
248 | 248 |
|
249 | | - inputA.addEventListener('input', runDiff) |
250 | | - inputB.addEventListener('input', runDiff) |
| 249 | + inputA.addEventListener('input', runDiff); |
| 250 | + inputB.addEventListener('input', runDiff); |
251 | 251 |
|
252 | 252 | // Run diff on initial load |
253 | | - runDiff() |
| 253 | + runDiff(); |
254 | 254 | </script> |
255 | 255 |
|
256 | 256 | <footer> |
|
0 commit comments