mirror of
https://github.com/spchcap/speech.capital.git
synced 2026-01-14 00:28:06 +00:00
Refactor: Version schema definition as schemaV1
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
const schema = [
|
||||
const schemaV1 = [
|
||||
`CREATE TABLE IF NOT EXISTS users (
|
||||
id INTEGER PRIMARY KEY,
|
||||
username TEXT UNIQUE NOT NULL,
|
||||
@@ -61,7 +61,7 @@ export async function onRequestPost({ request, env }) {
|
||||
}
|
||||
|
||||
if (action === 'create') {
|
||||
const stmts = schema.map(sql => db.prepare(sql));
|
||||
const stmts = schemaV1.map(sql => db.prepare(sql));
|
||||
const results = await db.batch(stmts);
|
||||
return Response.json({ success: true, results });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user