From bc0502ec6b03203e141cb6137df7b78190ef1234 Mon Sep 17 00:00:00 2001 From: Jared Henderson Date: Tue, 23 Aug 2022 15:47:55 -0400 Subject: [PATCH] changes to support monitoring udpates --- Sources/DuetSQL/WhereConstraint.swift | 7 +++++++ codegen/lib/models/graphql.ts | 1 + codegen/lib/models/model-attrs.ts | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Sources/DuetSQL/WhereConstraint.swift b/Sources/DuetSQL/WhereConstraint.swift index 2fc5086..5e9f562 100644 --- a/Sources/DuetSQL/WhereConstraint.swift +++ b/Sources/DuetSQL/WhereConstraint.swift @@ -238,6 +238,13 @@ public func != ( infix operator |=| +public func |=| ( + lhs: M.ColumnName, + rhs: [UUIDStringable] +) -> SQL.WhereConstraint { + .in(lhs, rhs.map { .uuid($0) }) +} + public func |=| ( lhs: M.ColumnName, rhs: [M.IdValue] diff --git a/codegen/lib/models/graphql.ts b/codegen/lib/models/graphql.ts index 6203874..70b92d4 100644 --- a/codegen/lib/models/graphql.ts +++ b/codegen/lib/models/graphql.ts @@ -344,6 +344,7 @@ function keyPath( if ( type === `Id` || type === `UUID` || + type === `[UUID]` || model.taggedTypes[type] === `UUID` || globalTypes.taggedTypes[type] === `UUID` || type.endsWith(`.Id`) diff --git a/codegen/lib/models/model-attrs.ts b/codegen/lib/models/model-attrs.ts index d5de135..cd15811 100644 --- a/codegen/lib/models/model-attrs.ts +++ b/codegen/lib/models/model-attrs.ts @@ -153,7 +153,7 @@ function setMigrationNumber(model: Model, lines: string[]): void { if (line.startsWith(`}`)) { return; } - const migrationMatch = line.match(/^ enum M(\d+) {$/); + const migrationMatch = line.match(/^ enum M(\d+)(: TableNamingMigration)? {$/); if (migrationMatch && !Number.isNaN(Number(migrationMatch[1]))) { inMigration = Number(migrationMatch[1]); }