refactor: update README and Dockerfile, add drizzle migrations and instrumentation
This commit is contained in:
@@ -70,7 +70,7 @@ export default function CreateDatasetModal() {
|
||||
},
|
||||
{
|
||||
label: loading ? 'Creating...' : 'Create',
|
||||
onClick: (e) => {
|
||||
onClick: () => {
|
||||
const form = document.getElementById('datasetForm') as HTMLFormElement;
|
||||
form?.dispatchEvent(new Event('submit', { bubbles: true }));
|
||||
},
|
||||
|
||||
22
src/instrumentation.ts
Normal file
22
src/instrumentation.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { migrate } from 'drizzle-orm/better-sqlite3/migrator';
|
||||
import db from '@/lib/db';
|
||||
import { join } from 'path';
|
||||
|
||||
export async function register() {
|
||||
if (process.env.NEXT_RUNTIME === 'nodejs') {
|
||||
try {
|
||||
console.log('Running database migrations...');
|
||||
|
||||
const migrationsFolder = join(process.cwd(), 'drizzle');
|
||||
|
||||
// Use Drizzle's built-in migrate function
|
||||
migrate(db, { migrationsFolder });
|
||||
|
||||
console.log('✓ Database migrations completed successfully');
|
||||
} catch (error) {
|
||||
console.error('Failed to run database migrations:', error);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user