Skip to content

Commit

Permalink
fix: domain flag is respected
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinClowers authored and RobinBlomberg committed Mar 19, 2024
1 parent bd18848 commit 684d30a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class Cli {
}

const dialectManager = new DialectManager({
skipDomains: !!options.domains,
domains: !!options.domains,
});
const dialect = dialectManager.getDialect(
options.dialectName ?? inferredDialectName,
Expand Down
4 changes: 2 additions & 2 deletions src/core/dialect-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export type DialectName =
| 'sqlite';

export type DialectManagerOptions = {
skipDomains?: boolean;
domains: boolean;
};

/**
Expand All @@ -26,7 +26,7 @@ export type DialectManagerOptions = {
export class DialectManager {
readonly #options: DialectManagerOptions;

constructor(options: DialectManagerOptions = {}) {
constructor(options: DialectManagerOptions = { domains: true }) {
this.#options = options;
}

Expand Down
4 changes: 2 additions & 2 deletions src/dialects/postgres/postgres-dialect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import { PostgresAdapter } from './postgres-adapter';
import { PostgresIntrospector } from './postgres-introspector';

export type PostgresDialectOptions = {
skipDomains?: boolean;
domains: boolean;
};

export class PostgresDialect extends Dialect {
readonly #options: PostgresDialectOptions;
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);
Expand Down
6 changes: 3 additions & 3 deletions src/dialects/postgres/postgres-introspector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type PostgresDomainInspector = {
};

export type PostgresIntrospectorOptions = {
skipDomains?: boolean;
domains: boolean;
};

export class PostgresIntrospector extends Introspector<PostgresDB> {
Expand All @@ -27,7 +27,7 @@ export class PostgresIntrospector extends Introspector<PostgresDB> {

constructor(
adapter: PostgresAdapter,
options: PostgresIntrospectorOptions = {},
options: PostgresIntrospectorOptions = { domains: true },
) {
super();
this.adapter = adapter;
Expand Down Expand Up @@ -104,7 +104,7 @@ export class PostgresIntrospector extends Introspector<PostgresDB> {
}

async #introspectDomains(db: Kysely<PostgresDB>) {
if (this.#options.skipDomains) {
if (!this.#options.domains) {
return [];
}

Expand Down

0 comments on commit 684d30a

Please sign in to comment.