22 lines
527 B
JavaScript
22 lines
527 B
JavaScript
import { mysqlConfig } from "../../config/index.js"
|
|
import { query } from "./base.js"
|
|
|
|
const dataname = mysqlConfig.database
|
|
/**
|
|
* 判断数据表是否存在
|
|
* @param {String} name 数据表名
|
|
* @return {Boolend} true 存在 false 不存在
|
|
*/
|
|
|
|
|
|
export async function isTable(name){
|
|
const list = await query("show tables")
|
|
for(const i in list){
|
|
console.log(list[i]["Tables_in_" + dataname])
|
|
if(name == list[i]["Tables_in_" + dataname]){
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|