fix: resolve SQLite field mismatch for large starred repo imports (#90)

- Add missing database fields (language, description, mirroredLocation, destinationOrg) to repository operations
  - Add missing organization fields (publicRepositoryCount, privateRepositoryCount, forkRepositoryCount) to schema
  - Update GitRepo interface to include all required database fields
  - Fix GitHub data fetching functions to map all fields correctly
  - Update all sync endpoints (main, repository, organization, scheduler) to handle new fields

  This fixes the "SQLite query expected X values, received Y" error when importing
  large numbers (4.6k+) of starred repositories by ensuring all database fields
  are properly mapped from GitHub API responses through to database insertion.
This commit is contained in:
Arunavo Ray
2025-09-09 09:56:18 +05:30
parent 2b78a6a4a8
commit 89ca5abe7d
13 changed files with 1968 additions and 83 deletions

View File

@@ -117,6 +117,8 @@ export const POST: APIRoute = async ({ request }) => {
owner: repo.owner.login,
organization:
repo.owner.type === "Organization" ? repo.owner.login : null,
mirroredLocation: "",
destinationOrg: null,
isPrivate: repo.private,
isForked: repo.fork,
forkedFrom: undefined,
@@ -126,6 +128,8 @@ export const POST: APIRoute = async ({ request }) => {
size: repo.size,
hasLFS: false,
hasSubmodules: false,
language: repo.language || null,
description: repo.description || null,
defaultBranch: repo.default_branch ?? "main",
visibility: (repo.visibility ?? "public") as RepositoryVisibility,
status: "imported" as RepoStatus,