From 4ce6597a1a2913c47c9cab8aebae940bb07c38aa Mon Sep 17 00:00:00 2001 From: Robin Clowers Date: Mon, 18 Mar 2024 14:05:37 -0700 Subject: [PATCH] fix: domain flag is respected --- src/cli/cli.ts | 2 +- src/core/dialect-manager.ts | 4 ++-- src/dialects/postgres/postgres-dialect.ts | 4 ++-- src/dialects/postgres/postgres-introspector.ts | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/cli/cli.ts b/src/cli/cli.ts index 3c24b4a..8eb6850 100644 --- a/src/cli/cli.ts +++ b/src/cli/cli.ts @@ -66,7 +66,7 @@ export class Cli { } const dialectManager = new DialectManager({ - skipDomains: !!options.domains, + domains: !!options.domains, }); const dialect = dialectManager.getDialect( options.dialectName ?? inferredDialectName, diff --git a/src/core/dialect-manager.ts b/src/core/dialect-manager.ts index b64e85e..aed560f 100644 --- a/src/core/dialect-manager.ts +++ b/src/core/dialect-manager.ts @@ -17,7 +17,7 @@ export type DialectName = | 'sqlite'; export type DialectManagerOptions = { - skipDomains?: boolean; + domains: boolean; }; /** @@ -26,7 +26,7 @@ export type DialectManagerOptions = { export class DialectManager { readonly #options: DialectManagerOptions; - constructor(options: DialectManagerOptions = {}) { + constructor(options: DialectManagerOptions = { domains: true }) { this.#options = options; } diff --git a/src/dialects/postgres/postgres-dialect.ts b/src/dialects/postgres/postgres-dialect.ts index a61d6f0..50120c3 100644 --- a/src/dialects/postgres/postgres-dialect.ts +++ b/src/dialects/postgres/postgres-dialect.ts @@ -5,7 +5,7 @@ import { PostgresAdapter } from './postgres-adapter'; import { PostgresIntrospector } from './postgres-introspector'; export type PostgresDialectOptions = { - skipDomains?: boolean; + domains: boolean; }; export class PostgresDialect extends Dialect { @@ -13,7 +13,7 @@ export class PostgresDialect extends Dialect { readonly adapter = new PostgresAdapter(); readonly introspector; - constructor(options: PostgresDialectOptions = {}) { + constructor(options: PostgresDialectOptions = { domains: true }) { super(); this.#options = options; this.introspector = new PostgresIntrospector(this.adapter, this.#options); diff --git a/src/dialects/postgres/postgres-introspector.ts b/src/dialects/postgres/postgres-introspector.ts index e2dd79e..1600a7a 100644 --- a/src/dialects/postgres/postgres-introspector.ts +++ b/src/dialects/postgres/postgres-introspector.ts @@ -18,7 +18,7 @@ type PostgresDomainInspector = { }; export type PostgresIntrospectorOptions = { - skipDomains?: boolean; + domains: boolean; }; export class PostgresIntrospector extends Introspector { @@ -27,7 +27,7 @@ export class PostgresIntrospector extends Introspector { constructor( adapter: PostgresAdapter, - options: PostgresIntrospectorOptions = {}, + options: PostgresIntrospectorOptions = { domains: true }, ) { super(); this.adapter = adapter; @@ -104,7 +104,7 @@ export class PostgresIntrospector extends Introspector { } async #introspectDomains(db: Kysely) { - if (this.#options.skipDomains) { + if (!this.#options.domains) { return []; }