Skip to content

Commit 6708721

Browse files
authored
Merge pull request #33 from BriefHQ/new-relationships
fix: bump to new release
2 parents 057072b + 24483a5 commit 6708721

File tree

8 files changed

+567
-153
lines changed

8 files changed

+567
-153
lines changed

package.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@
4949
"url": "https://github.com/BriefHQ/drizzle-zero/issues"
5050
},
5151
"peerDependencies": {
52-
"@rocicorp/zero": ">=0.12.2025012403",
52+
"@rocicorp/zero": ">=0.12.2025012501",
5353
"drizzle-orm": ">=0.36.0"
5454
},
5555
"devDependencies": {
56-
"@rocicorp/zero": "^0.12.2025012403",
56+
"@rocicorp/zero": "^0.12.2025012501",
5757
"@types/node": "^22.10.10",
5858
"@vitest/coverage-v8": "3.0.4",
5959
"@vitest/ui": "^3.0.4",
@@ -64,10 +64,5 @@
6464
"typescript": "^5.7.3",
6565
"vite-tsconfig-paths": "^5.1.4",
6666
"vitest": "^3.0.4"
67-
},
68-
"pnpm": {
69-
"patchedDependencies": {
70-
"@rocicorp/zero": "patches/@rocicorp__zero.patch"
71-
}
7267
}
7368
}

patches/@rocicorp__zero.patch

Lines changed: 0 additions & 26 deletions
This file was deleted.

pnpm-lock.yaml

Lines changed: 27 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/relations.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -608,12 +608,14 @@ const createZeroSchema = <
608608

609609
relationships[tableName as keyof typeof relationships] = {
610610
...(relationships?.[tableName as keyof typeof relationships] ?? {}),
611-
[relation.fieldName]: [{
612-
sourceField: sourceFieldNames,
613-
destField: destFieldNames,
614-
destSchema: relation.referencedTableName,
615-
cardinality: is(relation, One) ? "one" : "many",
616-
}],
611+
[relation.fieldName]: [
612+
{
613+
sourceField: sourceFieldNames,
614+
destField: destFieldNames,
615+
destSchema: relation.referencedTableName,
616+
cardinality: is(relation, One) ? "one" : "many",
617+
},
618+
],
617619
} as unknown as (typeof relationships)[keyof typeof relationships];
618620
}
619621
}

src/tables.ts

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import {
2-
type ColumnBuilder,
3-
type TableBuilderWithColumns,
2+
type SchemaValue,
3+
type TableSchema,
44
boolean as zeroBoolean,
5+
enumeration as zeroEnumeration,
56
json as zeroJson,
67
number as zeroNumber,
78
string as zeroString,
8-
enumeration as zeroEnumeration,
99
table as zeroTable,
1010
} from "@rocicorp/zero";
1111
import { getTableColumns, getTableName, Table } from "drizzle-orm";
@@ -26,6 +26,23 @@ import type {
2626
} from "./types";
2727
import { typedEntries } from "./util";
2828

29+
declare class ColumnBuilder<TShape extends SchemaValue<any>> {
30+
get schema(): TShape;
31+
}
32+
33+
declare class TableBuilderWithColumns<TShape extends TableSchema> {
34+
constructor(schema: TShape);
35+
primaryKey<TPKColNames extends (keyof TShape["columns"])[]>(
36+
...pkColumnNames: TPKColNames
37+
): TableBuilderWithColumns<
38+
TShape & {
39+
primaryKey: TPKColNames;
40+
}
41+
>;
42+
get schema(): TShape;
43+
build(): TShape;
44+
}
45+
2946
/**
3047
* Represents a column definition from a Drizzle table, filtered by column name.
3148
* @template TTable The Drizzle table type

0 commit comments

Comments
 (0)