Skip to content

codex 5.3-xhigh: Implement support for SQLite #135

Draft
sorenbs wants to merge 1 commit intomainfrom
sqlite-experiment
Draft

codex 5.3-xhigh: Implement support for SQLite #135
sorenbs wants to merge 1 commit intomainfrom
sqlite-experiment

Conversation

@sorenbs
Copy link
Member

@sorenbs sorenbs commented Feb 6, 2026

Prompt:

Please look at the repository. Carefully study all markdown files, and pay special attention to the architectural boundaries defined. This repository implements an ORM that currently only supports Postgres. I want you to identify all the areas we need to extend in order to also support SQLite. In addition to adding support, I want to also duplicate the demo app and port all the existing queries to SQLite.
Please create a SQLITE-PLAN.md file that I can hand over to a coding agent to implement this. Point out all the work that has to be done, and be very explicit about the architectural boundaries we need to respect. Add a section called Architectural Challenges, and instruct the agent to list and explain any issues it has with the existing architectural decisions. It could be that we need to change some of the rules, but I want to have those changes clearly listed.
After completing the plan document, start implementation.

…xhigh: Please look at the repository. Carefully study all markdown files, and pay special attention to the architectural boundaries defined. This repository implements an ORM that currently only supports Postgres. I want you to identify all the areas we need to extend in order to also support SQLite. In addition to adding support, I want to also duplicate the demo app and port all the existing queries to SQLite. Please create a SQLITE-PLAN.md file that I can hand over to a coding agent to implement this. Point out all the work that has to be done, and be very explicit about the architectural boundaries we need to respect. Add a section called Architectural Challenges, and instruct the agent to list and explain any issues it has with the existing architectural decisions. It could be that we need to change some of the rules, but I want to have those changes clearly listed. After completing the plan document, start implementation.
@coderabbitai
Copy link

coderabbitai bot commented Feb 6, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger a full review

Note

🎁 Summarized by CodeRabbit Free

The PR author is not assigned a seat. To perform a comprehensive line-by-line review, please assign a seat to the pull request author through the subscription management page by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands and usage tips.

Comment on lines +927 to +961
if (targetId === 'sqlite') {
return [
{
sql: `create table if not exists prisma_contract_marker (
id integer primary key,
core_hash text not null,
profile_hash text not null,
contract_json text,
canonical_version integer,
updated_at text not null default (CURRENT_TIMESTAMP),
app_tag text,
meta text not null default '{}'
)`,
params: [],
},
];
}

// Default: Postgres schema + table.
return [
{ sql: 'create schema if not exists prisma_contract', params: [] },
{
sql: `create table if not exists prisma_contract.marker (
id smallint primary key default 1,
core_hash text not null,
profile_hash text not null,
contract_json jsonb,
canonical_version int,
updated_at timestamptz not null default now(),
app_tag text,
meta jsonb not null default '{}'
)`,
params: [],
},
];
Copy link
Contributor

@wmadden wmadden Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need an abstraction for this - it can't be a switch statement on target ID. Perhaps we could delegate this to the control adapter?

Comment on lines 10 to +15
readonly postgres?: {
readonly nativeType: string; // e.g. 'integer', 'text', 'vector', 'timestamp with time zone'
};
readonly sqlite?: {
readonly nativeType: string; // e.g. 'integer', 'text', 'real'
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No target-keyed dictionaries in the SQL domain

Comment on lines +915 to +924
type SqlStatement = { readonly sql: string; readonly params: readonly unknown[] };

type WriteMarkerInput = {
readonly coreHash: string;
readonly profileHash: string;
readonly contractJson?: unknown;
readonly canonicalVersion?: number | null;
readonly appTag?: string | null;
readonly meta?: Record<string, unknown>;
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The control plane has been suffering for lack of a DDL query interface - this is really highlighted now 🙈

Comment on lines 41 to +56
if (config.contract.target === 'postgres') {
return {
createAdapter: () => new PostgresAdapter(),
createDriver: () => new KyselyPrismaDriver(config),
createIntrospector: (db: Kysely<unknown>) => new PostgresIntrospector(db),
createQueryCompiler: () => new PostgresQueryCompiler(),
};
}
if (config.contract.target === 'sqlite') {
return {
createAdapter: () => new SqliteAdapter(),
createDriver: () => new KyselyPrismaDriver(config),
createIntrospector: (db: Kysely<unknown>) => new SqliteIntrospector(db),
createQueryCompiler: () => new SqliteQueryCompiler(),
};
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OMG another switch statement on target ID 😭

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants