fix(db): non-null assertions in seed for noUncheckedIndexedAccess
This commit is contained in:
@@ -3,11 +3,11 @@ import { cards, lessons } from './schema.js';
|
|||||||
|
|
||||||
const { db, sqlite } = createDb();
|
const { db, sqlite } = createDb();
|
||||||
const [root] = db.insert(lessons).values({ name: 'Demo: Spaans', position: 0 }).returning().all();
|
const [root] = db.insert(lessons).values({ name: 'Demo: Spaans', position: 0 }).returning().all();
|
||||||
const [sub] = db.insert(lessons).values({ name: 'Begroetingen', parentId: root.id, position: 0 }).returning().all();
|
const [sub] = db.insert(lessons).values({ name: 'Begroetingen', parentId: root!.id, position: 0 }).returning().all();
|
||||||
db.insert(cards).values([
|
db.insert(cards).values([
|
||||||
{ lessonId: sub.id, question: 'Hallo', answer: 'Hola', position: 0 },
|
{ lessonId: sub!.id, question: 'Hallo', answer: 'Hola', position: 0 },
|
||||||
{ lessonId: sub.id, question: 'Goedemorgen', answer: 'Buenos días', position: 1 },
|
{ lessonId: sub!.id, question: 'Goedemorgen', answer: 'Buenos días', position: 1 },
|
||||||
{ lessonId: sub.id, question: 'Tot ziens', answer: 'Adiós', position: 2 },
|
{ lessonId: sub!.id, question: 'Tot ziens', answer: 'Adiós', position: 2 },
|
||||||
]).run();
|
]).run();
|
||||||
sqlite.close();
|
sqlite.close();
|
||||||
console.log('Seed inserted.');
|
console.log('Seed inserted.');
|
||||||
|
|||||||
Reference in New Issue
Block a user