2 Commits

Author SHA1 Message Date
6ef8812a79 1.0.9 2022-03-08 18:54:10 +01:00
3034ef2edd fix(TTL): tables now have a default TTL for data of 1 MONTH 2022-03-08 18:54:10 +01:00
3 changed files with 15 additions and 7 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "@pushrocks/smartclickhouse",
"version": "1.0.8",
"version": "1.0.9",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@pushrocks/smartclickhouse",
"version": "1.0.8",
"version": "1.0.9",
"license": "MIT",
"dependencies": {
"@depyronick/clickhouse-client": "^1.0.12",

View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartclickhouse",
"version": "1.0.8",
"version": "1.0.9",
"private": false,
"description": "an odm for talking to clickhouse",
"main": "dist_ts/index.js",

View File

@ -32,10 +32,18 @@ export class TimeDataTable {
// create table in clickhouse
await smartClickHouseDbRefArg.clickhouseClient
.queryPromise(`CREATE TABLE IF NOT EXISTS ${newTable.tableName} (
.queryPromise(`
CREATE TABLE IF NOT EXISTS ${newTable.tableName} (
timestamp DateTime64(3, 'Europe/Berlin'),
message String
) ENGINE=MergeTree() ORDER BY timestamp`);
) ENGINE=MergeTree() ORDER BY timestamp
`);
// lets adjust the TTL
await smartClickHouseDbRefArg.clickhouseClient
.queryPromise(`
ALTER TABLE ${newTable.tableName} MODIFY TTL toDateTime(timestamp) + INTERVAL 1 MONTH;
`);
await newTable.updateColumns();
console.log(`=======================`)