0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-03-17 23:11:29 -05:00

fix: escape name on drop table

This commit is contained in:
bholmesdev 2024-02-13 14:23:56 -05:00
parent bab9871dad
commit 30cf903fe0

View file

@ -29,7 +29,7 @@ export async function recreateTables({
}) {
const setupQueries: SQL[] = [];
for (const [name, collection] of Object.entries(collections)) {
const dropQuery = sql.raw(`DROP TABLE IF EXISTS ${name}`);
const dropQuery = sql.raw(`DROP TABLE IF EXISTS ${sqlite.escapeName(name)}`);
const createQuery = sql.raw(getCreateTableQuery(name, collection));
const indexQueries = getCreateIndexQueries(name, collection);
setupQueries.push(dropQuery, createQuery, ...indexQueries.map((s) => sql.raw(s)));