Skip to content

Commit e5cd576

Browse files
committed
Merge branch 'alternation-engine' of https://github.com/drizzle-team/drizzle-orm into alternation-engine
2 parents dd2142c + 02522e1 commit e5cd576

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

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

Lines changed: 3 additions & 1 deletion
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) {
@@ -594,7 +596,7 @@ export const fromDrizzleSchema = (
594596
});
595597

596598
for (const view of combinedViews) {
597-
if (view.isExisting && filter({ type: 'table', schema: view.schema ?? 'public', name: view.name })) continue;
599+
if (view.isExisting && !filter({ type: 'table', schema: view.schema ?? 'public', name: view.name })) continue;
598600

599601
const { name: viewName, schema, query, withNoData, materialized } = view;
600602

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)