Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export async function writeMigrationRecords (ctx, data) {
await ensureTable(ctx)
const tableName = getTableName(ctx)
await ctx.fauna.query(
q.Update(q.Collection(tableName), {
data,
}),
)
}
export async function readMigrationRecords (ctx) {
await ensureTable(ctx)
const { data } = await ctx.fauna.query(
q.Get(q.Collection(getTableName(ctx))),
)
if (!data.files || !data.plugins) {
return {
files: [],
plugins: [],
}
} else {
return data
}
}