Skip to content

Commit

Permalink
fix: fix migration hash mismatched issue (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
dipendraupreti authored Aug 17, 2023
1 parent 4b05d70 commit 5931143
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/migration-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,18 @@ const getFileContents = async (filePath: string) => readFile(filePath, "utf8")
const hashString = (s: string) =>
crypto.createHash("sha1").update(s, "utf8").digest("hex")

const convertEndings = (content: string) => content.replace(/\r\n|\r/g, "\n")

const getSqlStringLiteral = (
filePath: string,
contents: string,
type: "js" | "sql",
) => {
switch (type) {
case "sql":
return contents
return convertEndings(contents)
case "js":
return loadSqlFromJs(filePath)
return convertEndings(loadSqlFromJs(filePath))
default: {
const exhaustiveCheck: never = type
return exhaustiveCheck
Expand Down

0 comments on commit 5931143

Please sign in to comment.