@mastra/clickhouse 1.5.0 → 1.5.1-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -4981,6 +4981,9 @@ var SIGNAL_MIGRATIONS = [
4981
4981
  { table: TABLE_SCORE_EVENTS, createDDL: SCORE_EVENTS_DDL, idColumn: "scoreId" },
4982
4982
  { table: TABLE_FEEDBACK_EVENTS, createDDL: FEEDBACK_EVENTS_DDL, idColumn: "feedbackId" }
4983
4983
  ];
4984
+ function isReplacingMergeTreeEngine(engine) {
4985
+ return engine.endsWith("ReplacingMergeTree");
4986
+ }
4984
4987
  async function getTableEngine(client, table) {
4985
4988
  const result = await client.query({
4986
4989
  query: `SELECT engine FROM system.tables WHERE database = currentDatabase() AND name = {table:String}`,
@@ -5018,7 +5021,7 @@ async function checkSignalTablesMigrationStatus(client) {
5018
5021
  const tables = [];
5019
5022
  for (const { table, idColumn } of SIGNAL_MIGRATIONS) {
5020
5023
  const engine = await getTableEngine(client, table);
5021
- if (!engine || engine === "ReplacingMergeTree") {
5024
+ if (!engine || isReplacingMergeTreeEngine(engine)) {
5022
5025
  continue;
5023
5026
  }
5024
5027
  tables.push({ table, engine, idColumn });
@@ -5031,7 +5034,7 @@ async function checkSignalTablesMigrationStatus(client) {
5031
5034
  async function migrateSignalTables(client, logger) {
5032
5035
  for (const { table, createDDL, idColumn } of SIGNAL_MIGRATIONS) {
5033
5036
  const engine = await getTableEngine(client, table);
5034
- if (!engine || engine === "ReplacingMergeTree") continue;
5037
+ if (!engine || isReplacingMergeTreeEngine(engine)) continue;
5035
5038
  logger?.info?.(`Migrating ${table} from ${engine} to ReplacingMergeTree with ${idColumn} column`);
5036
5039
  const temp = `${table}_migrating_${Date.now()}`;
5037
5040
  try {