Skip to content
This repository was archived by the owner on Mar 1, 2026. It is now read-only.

Commit 7436243

Browse files
committed
fix: address PR comments
1 parent 06dd907 commit 7436243

3 files changed

Lines changed: 11 additions & 6 deletions

File tree

packages/cli/src/actions/db.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ async function runPull(options: PullOptions) {
657657
parseResult: { value: documentModel },
658658
} of docs) {
659659
const zmodelSchema = await formatDocument(generator.generate(documentModel));
660-
console.log(colors.blue(`Writing to ${uri.path}`));
660+
console.log(colors.blue(`Writing to ${path.relative(process.cwd(), uri.fsPath).replace(/\\/g, '/')}`));
661661
fs.writeFileSync(uri.fsPath, zmodelSchema);
662662
}
663663
}

packages/cli/src/actions/pull/provider/sqlite.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,12 @@ export const sqlite: IntrospectionProvider = {
156156
const tableName = t.name;
157157
const schema = '';
158158

159-
// Check if this table has autoincrement (via sqlite_sequence)
159+
// Check if this table has autoincrement (detected by parsing the CREATE TABLE DDL)
160160
const hasAutoIncrement = autoIncrementTables.has(tableName);
161161

162162
// PRAGMA table_xinfo: extended version of table_info that also includes hidden/generated columns.
163163
// Returns one row per column with: cid (column index), name, type, notnull, dflt_value, pk.
164-
// hidden: 0 = normal column, 1 = hidden/internal (e.g., rowid), 2 = generated/computed column.
164+
// hidden: 0 = normal, 1 = hidden (virtual table), 2 = generated stored, 3 = generated virtual.
165165
const columnsInfo = all<{
166166
cid: number;
167167
name: string;

packages/cli/src/actions/pull/utils.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,16 @@ export function getDatasource(model: Model) {
7272
?.filter((s) => s !== undefined)) as string[] ||
7373
[];
7474

75+
const provider = getStringLiteral(
76+
datasource.fields.find((f) => f.name === 'provider')?.value,
77+
);
78+
if (!provider) {
79+
throw new CliError(`Datasource "${datasource.name}" is missing a "provider" field.`);
80+
}
81+
7582
return {
7683
name: datasource.name,
77-
provider: getStringLiteral(
78-
datasource.fields.find((f) => f.name === 'provider')?.value,
79-
) as DataSourceProviderType,
84+
provider: provider as DataSourceProviderType,
8085
url,
8186
defaultSchema,
8287
schemas,

0 commit comments

Comments
 (0)