nocobase/packages/core/database/src/query-interface/sqlite-query-interface.ts
ChengLei Shao d1fb3c92d8
test: with collection_manager_schema env (#1532)
* test: with collection_manager_schema env

* fix: remove collection

* fix: collection test

* fix: collection exist in db with custom schema

* fix: inherited with custom collection schema

* fix: build error

* fix: sync unique index & database logger
2023-03-05 14:45:56 +08:00

19 lines
584 B
TypeScript

import QueryInterface from './query-interface';
import { Collection } from '../collection';
export default class SqliteQueryInterface extends QueryInterface {
constructor(db) {
super(db);
}
async collectionTableExists(collection: Collection, options?) {
const transaction = options?.transaction;
const tableName = collection.model.tableName;
const sql = `SELECT name FROM sqlite_master WHERE type='table' AND name='${tableName}';`;
const results = await this.db.sequelize.query(sql, { type: 'SELECT', transaction });
return results.length > 0;
}
}