Created
March 14, 2024 04:06
-
-
Save mattfysh/4e775659aada68a66b78e3b846ebd4a1 to your computer and use it in GitHub Desktop.
using push-generated statements in `generate:sqlite`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { get, patch, wrapImports } from './rewire' | |
const push = get('logSuggestionsAndReturn2') | |
const move = patch('_moveDataStatements', function (tableName, json) { | |
// set dataLoss=false to generate copy statements | |
return move.call(this, tableName, json, false) | |
}) | |
wrapImports('init_migrate', { | |
async prepareSQL(prep, json1, json2) { | |
const { statements, _meta: meta } = await prep() | |
const connection = { | |
query: async () => [{ count: 0 }], | |
} | |
const { statementsToExecute: sqlStatements } = await push({ | |
connection, | |
statements, | |
json1, | |
json2, | |
meta, | |
}) | |
return { statements, sqlStatements, meta } | |
}, | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment