Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/server/sync.dto.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import { z } from "zod/v4";

export const SyncRequest = z.object({
db: z.string().startsWith("postgres://"),
// We shouldn't be doing separate validations on both the front end and here? Should probably consolidate
db: z
.string()
.refine(
(val) => val.startsWith("postgres://") || val.startsWith("postgresql://"),
{
message: "Must start with 'postgres://' or 'postgresql://'",
}
),
seed: z.coerce.number().min(0).max(1).default(0),
schema: z.coerce.string().default("public"),
requiredRows: z.coerce.number().positive().default(2),
Expand Down
2 changes: 1 addition & 1 deletion src/sync/pg-connector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ export class PostgresConnector implements DatabaseConnector<PostgresTuple> {
",\n "
)} from (select * from ${doubleQuote(
table
)} where ctid = any($1::tid[]))`;
)} where ctid = any($1::tid[])) as samples`;
const serialized = await this.sql.unsafe(query, [allCtids]);

const estimate = this.tupleEstimates.get(table) ?? "?";
Expand Down