import { dbConnection } from "db"; import type { NextApiRequest, NextApiResponse } from "next"; export default async function handler( req: NextApiRequest, res: NextApiResponse ) { try { if (req.method === "GET") { const db = await dbConnection; const users = "DROP TABLE users"; await db.all(users); const resource = "DROP TABLE resource"; await db.all(resource); const staking_source = "DROP TABLE staking_source"; await db.all(staking_source); const resource_well = "DROP TABLE resource_well"; await db.all(resource_well); const staking_event = "DROP TABLE staking_event"; await db.all(staking_event); const claim_event = "DROP TABLE claim_event"; await db.all(claim_event); const upgrade_event = "DROP TABLE upgrade_event"; await db.all(upgrade_event); const store_item = "DROP TABLE store_item"; await db.all(store_item); const inventory_item = "DROP TABLE inventory_item"; await db.all(inventory_item); const bank_account = "DROP TABLE bank_account"; await db.all(bank_account); const resource_account = "DROP TABLE resource_account"; await db.all(resource_account); res.status(200).json("Tables dropped"); } } catch (error) { res.status(500).json(error); } }