Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve drizzle-orm SQLite default template #484

Open
hyunbinseo opened this issue Mar 12, 2025 · 0 comments
Open

Improve drizzle-orm SQLite default template #484

hyunbinseo opened this issue Mar 12, 2025 · 0 comments

Comments

@hyunbinseo
Copy link
Contributor

hyunbinseo commented Mar 12, 2025

As of Svelte CLI v0.6.26

  1. db:generate is not included in the scripts:
  "db:push": "drizzle-kit push",
  "db:migrate": "drizzle-kit migrate",
  "db:studio": "drizzle-kit studio"
  "db:migrate": "drizzle-kit migrate", // missing
  1. Unused variable is included in the schema.ts file:
// 'text' is declared but its value is never read.ts(6133)
import { sqliteTable, text, integer } from 'drizzle-orm/sqlite-core';

export const user = sqliteTable('user', {
  id: integer('id').primaryKey(),
  age: integer('age')
});
  1. Line-breaks are missing in the drizzle.config.ts file:
import { defineConfig } from 'drizzle-kit';
if (!process.env.DATABASE_URL) throw new Error('DATABASE_URL is not set');
  1. loadEnvFile should probably be called in the drizzle.config.ts file:
import { defineConfig } from 'drizzle-kit';
import { loadEnvFile } from 'node:process';

loadEnvFile();

if (!process.env.DATABASE_URL) throw new Error('DATABASE_URL is not set');
  1. @types/node should probably be installed out-of-the box.
import { defineConfig } from 'drizzle-kit';

// Cannot find name 'process'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.ts(2580)
if (!process.env.DATABASE_URL) throw new Error('DATABASE_URL is not set');
  1. Line-breaks are missing in the src\lib\server\db\index.ts file:
import { drizzle } from 'drizzle-orm/libsql';
import { createClient } from '@libsql/client';
import * as schema from './schema';
import { env } from '$env/dynamic/private';
if (!env.DATABASE_URL) throw new Error('DATABASE_URL is not set');
const client = createClient({ url: env.DATABASE_URL });

Are there reasons behind these decisions? If not, I would love to create a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant