MCPcopy
hub / github.com/sequelize/sequelize / tableExists

Method tableExists

src/dialects/abstract/query-interface.js:239–248  ·  view source on GitHub ↗

* Returns a promise that will resolve to true if the table exists in the database, false otherwise. * * @param {TableName} tableName - The name of the table * @param {QueryOptions} options - Query options * @returns {Promise }

(tableName, options)

Source from the content-addressed store, hash-verified

237 * @returns {Promise<boolean>}
238 */
239 async tableExists(tableName, options) {
240 const sql = this.queryGenerator.tableExistsQuery(tableName);
241
242 const out = await this.sequelize.query(sql, {
243 ...options,
244 type: QueryTypes.SHOWTABLES
245 });
246
247 return out.length === 1;
248 }
249
250 /**
251 * Drop a table from database

Callers 1

syncMethod · 0.80

Calls 2

tableExistsQueryMethod · 0.45
queryMethod · 0.45

Tested by

no test coverage detected