fix: don't support old queries and mutators in schema
This commit is contained in:
@@ -17,6 +17,7 @@ import {
|
||||
} from "@money/shared";
|
||||
import type { AuthData } from "@money/shared/auth";
|
||||
import { getHono } from "./hono";
|
||||
import { db } from "./db";
|
||||
|
||||
|
||||
const processor = new PushProcessor(
|
||||
@@ -30,6 +31,12 @@ const createMutators = (authData: AuthData | null) => {
|
||||
const mutators = createMutatorsShared(authData);
|
||||
return {
|
||||
...mutators,
|
||||
link: {
|
||||
...mutators.link,
|
||||
async create() {
|
||||
console.log("Here is my function running on the server!!!");
|
||||
}
|
||||
}
|
||||
} as const satisfies Mutators;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ export default function RootLayout() {
|
||||
<ZeroProvider {...zeroProps}>
|
||||
<Stack>
|
||||
<Stack.Protected guard={!isPending && !!session}>
|
||||
<Stack.Screen name="index" />
|
||||
<Stack.Screen name="index" options={{ headerShown: false }} />
|
||||
</Stack.Protected>
|
||||
<Stack.Protected guard={!isPending && !session}>
|
||||
<Stack.Screen name="auth" />
|
||||
|
||||
@@ -32,6 +32,9 @@ export default function HomeScreen() {
|
||||
<Button onPress={() => {
|
||||
z.mutate.transaction.deleteAll();
|
||||
}} title="Delete" />
|
||||
<Button onPress={() => {
|
||||
z.mutate.link.create();
|
||||
}} title="Open link" />
|
||||
</SafeAreaView>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
"drizzle-zero": "^0.14.3"
|
||||
},
|
||||
"scripts": {
|
||||
"generate:zero": "drizzle-zero generate -s ./src/db/schema/public.ts -o ./src/zero-schema.gen.ts -f",
|
||||
"generate:zero": "drizzle-zero generate -s ./src/db/schema/public.ts -o ./src/zero-schema.gen.ts -f && sed -i 's/enableLegacyQueries: true,/enableLegacyQueries: false,/g' src/zero-schema.gen.ts && sed -i 's/enableLegacyMutators: true,/enableLegacyMutators: false,/g' src/zero-schema.gen.ts",
|
||||
"db:migrate": "drizzle-kit push"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,10 @@ export function createMutators(authData: AuthData | null) {
|
||||
for (const i of t) {
|
||||
await tx.mutate.transaction.delete({ id: i.id });
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
link: {
|
||||
async create() {}
|
||||
}
|
||||
} as const;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
import { type Schema as ZeroSchema, definePermissions } from "@rocicorp/zero";
|
||||
import { schema as genSchema } from "./zero-schema.gen";
|
||||
|
||||
export const schema = {
|
||||
...genSchema,
|
||||
enableLegacyMutators: false,
|
||||
enableLegacyQueries: false,
|
||||
} satisfies ZeroSchema;
|
||||
import { definePermissions } from "@rocicorp/zero";
|
||||
import { schema } from "./zero-schema.gen";
|
||||
|
||||
export const permissions = definePermissions(schema, () => ({}));
|
||||
|
||||
@@ -138,8 +138,8 @@ export const schema = {
|
||||
},
|
||||
},
|
||||
relationships: {},
|
||||
enableLegacyQueries: true,
|
||||
enableLegacyMutators: true,
|
||||
enableLegacyQueries: false,
|
||||
enableLegacyMutators: false,
|
||||
} as const;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user