Skip to content

Commit 02522e1

Browse files
committed
fix crdb drizzle talbes filtering
1 parent 8dc14dc commit 02522e1

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

drizzle-kit/src/dialects/cockroach/drizzle.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,8 @@ export const fromDrizzleSchema = (
247247

248248
const tableConfigPairs = schema.tables.map((it) => {
249249
return { config: getTableConfig(it), table: it };
250+
}).filter((it) => {
251+
return filter({ type: 'table', schema: it.config.schema ?? 'public', name: it.config.name });
250252
});
251253

252254
for (const policy of schema.policies) {

drizzle-kit/tests/cockroach/pull.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ test.concurrent('introspect view in other schema', async ({ dbc: db }) => {
542542
db,
543543
schema,
544544
'introspect-view-in-other-schema',
545-
['new_schema'],
545+
['new_schema', 'public'],
546546
);
547547

548548
expect(statements.length).toBe(0);
@@ -552,11 +552,11 @@ test.concurrent('introspect view in other schema', async ({ dbc: db }) => {
552552
test.concurrent('introspect materialized view in other schema', async ({ db }) => {
553553
const newSchema = cockroachSchema('new_schema');
554554
const users = cockroachTable('users', {
555-
id: int4('id').primaryKey().notNull(),
556-
name: varchar('users'),
555+
id: int4().primaryKey(),
556+
name: varchar(),
557557
});
558558

559-
const view = newSchema.materializedView('some_view', { id: int4('asd') }).as(
559+
const view = newSchema.materializedView('some_view', { id: int4() }).as(
560560
sql`SELECT * FROM ${users}`,
561561
);
562562
const schema = {
@@ -569,7 +569,7 @@ test.concurrent('introspect materialized view in other schema', async ({ db }) =
569569
db,
570570
schema,
571571
'introspect-mat-view-in-other-schema',
572-
['new_schema'],
572+
['new_schema', 'public'],
573573
);
574574

575575
expect(statements.length).toBe(0);

0 commit comments

Comments
 (0)