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
7 changes: 0 additions & 7 deletions packages/api/src/cli/d1-to-planetscale-copy-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,6 @@ export function mapSqliteRowToPostgres(row: Record<string, unknown>, destTable:
return mapped
}

export function normalizePostgresRow(
row: Record<string, unknown>,
destTable: Table,
): Record<string, unknown> {
return mapSqliteRowToPostgres(row, destTable)
}

export function primaryKeyToken(
row: Record<string, unknown>,
primaryKeys: readonly string[],
Expand Down
7 changes: 3 additions & 4 deletions packages/api/src/cli/d1-to-planetscale-copy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
import {
canonicalCopyRow,
mapSqliteRowToPostgres,
normalizePostgresRow,
primaryKeyToken,
rowsEqual,
} from "./d1-to-planetscale-copy-map"
Expand Down Expand Up @@ -280,7 +279,7 @@ async function needsSeedReconciliation(

if (!seed) return false

if (!rowsEqual(normalizePostgresRow(seed, skills.spec.postgres), originalBuiltinSeed))
if (!rowsEqual(mapSqliteRowToPostgres(seed, skills.spec.postgres), originalBuiltinSeed))
throw new CopyConflictError(
"Destination PR built-in is not the untouched migration seed. Refusing to delete it.",
)
Expand Down Expand Up @@ -314,7 +313,7 @@ async function verifyTable(source: SourceTable, dest: CopyDestination, batchSize
const byKey = new Map(
destination.map((row) => [
primaryKeyToken(row, source.spec.primaryKeys),
normalizePostgresRow(row, source.spec.postgres),
mapSqliteRowToPostgres(row, source.spec.postgres),
]),
)

Expand Down Expand Up @@ -392,7 +391,7 @@ async function runCopy(input: CopyInput): Promise<CopyReport> {
const byKey = new Map(
destination.map((row) => [
primaryKeyToken(row, source.spec.primaryKeys),
normalizePostgresRow(row, source.spec.postgres),
mapSqliteRowToPostgres(row, source.spec.postgres),
]),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ export async function compileCloudflareAiGatewayProviderOptions(input: {
Option.filter(
() =>
input.providerId === CLOUDFLARE_AI_GATEWAY_PROVIDER_ID &&
input.providerId === input.selectedProviderId,
input.selectedProviderId === CLOUDFLARE_AI_GATEWAY_PROVIDER_ID,
),
)

return await Option.match(byokProvider, {
return Option.match(byokProvider, {
onNone: () => Promise.resolve(Option.none<Record<string, unknown>>()),
onSome: (provider) => compileSelectedProviderOptions(input, provider),
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ async function authorizedWorkflowContext(input: {
),
)

return await Option.match(candidate, {
return Option.match(candidate, {
onNone: () => Promise.resolve(Option.none<WorkflowCallbackContext>()),
onSome: ({ context, participant }) =>
authorizeStoredWorkflowRun(input.workflowStore, context, participant.user_id),
Expand Down
6 changes: 1 addition & 5 deletions packages/infra/src/stacks/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ export interface CreatePlanetscaleAppDatabaseInput {
readonly config?: S0PlanetscaleConfig
}

export function pgMigrationsDir() {
return resolve(INFRA_DIR, "migrations/pg")
}

export function createPlanetscaleAppDatabase(input: CreatePlanetscaleAppDatabaseInput) {
return Effect.gen(function* () {
const { logicalDatabaseName, region, ...provisioning } =
Expand Down Expand Up @@ -45,7 +41,7 @@ export function createPlanetscaleAppDatabase(input: CreatePlanetscaleAppDatabase
adminOrigin: adminRole.origin,
appRoleName: Output.map(appRole.username, PlanetscaleLogicalDb.postgresRoleNameFromUsername),
appRolePrivilegesVersion: 1,
migrationsDir: pgMigrationsDir(),
migrationsDir: resolve(INFRA_DIR, "migrations/pg"),
name: logicalDatabaseName,
})

Expand Down
Loading