mirror of
https://github.com/lingble/clickhouse.git
synced 2025-11-01 19:47:50 +00:00
drop supports also on cluster
This commit is contained in:
2
index.js
2
index.js
@@ -492,7 +492,7 @@ class QueryCursor {
|
||||
// Hack for Sequelize ORM
|
||||
query = query.trim().trimEnd().replace(/;$/gm, "");
|
||||
|
||||
if (query.match(/^(select|show|exists|create)/i)) {
|
||||
if (query.match(/^(select|show|exists|create|drop)/i)) {
|
||||
if ( ! R_FORMAT_PARSER.test(query)) {
|
||||
query += ` FORMAT ${ClickHouse.getFullFormatName(me.format)}`;
|
||||
}
|
||||
|
||||
13
test/test.js
13
test/test.js
@@ -36,14 +36,19 @@ before(async () => {
|
||||
|
||||
describe('On cluster', () => {
|
||||
// Note: this test only works with ClickHouse setup as Cluster named test_cluster
|
||||
it('should be able to create table', async () => {
|
||||
const query = `
|
||||
it('should be able to create and drop a table', async () => {
|
||||
const createTableQuery = `
|
||||
CREATE TABLE ${database}.test_on_cluster ON CLUSTER test_cluster (
|
||||
test String
|
||||
)
|
||||
ENGINE=MergeTree ORDER BY test;`;
|
||||
const r = await clickhouse.query(query).toPromise();
|
||||
expect(r).to.be.ok();
|
||||
const createTableQueryResult = await clickhouse.query(createTableQuery).toPromise();
|
||||
expect(createTableQueryResult).to.be.ok();
|
||||
|
||||
const dropTableQuery = `
|
||||
DROP TABLE ${database}.test_on_cluster ON CLUSTER test_cluster;`;
|
||||
const dropTableQueryResult = await clickhouse.query(dropTableQuery).toPromise();
|
||||
expect(dropTableQueryResult).to.be.ok();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user