File tree Expand file tree Collapse file tree 22 files changed +22
-198
lines changed
01.solution.simple/src/db
02.problem.template/src/db
02.solution.template/src/db
04.problem.completion/src/db
04.solution.completion/src/db
05.solution.linked/src/db
06.problem.embedded/src/db
06.solution.embedded/src/db
01.problem.prompts/src/db
01.solution.prompts/src/db
02.problem.optimized-prompt/src/db
02.solution.optimized-prompt/src/db
03.problem.completion/src/db
03.solution.completion/src/db
01.solution.simple/src/db
02.problem.advanced/src/db
02.solution.advanced/src/db Expand file tree Collapse file tree 22 files changed +22
-198
lines changed Original file line number Diff line number Diff line change @@ -4,18 +4,10 @@ import { DB } from './index.js'
44
55async function seed ( ) {
66 const dbPath = path . join ( process . cwd ( ) , 'db.sqlite' )
7- const dbExists = await fs . stat ( dbPath ) . then (
8- ( ) => true ,
9- ( ) => false ,
10- )
11- // delete the db file if it exists
12- if ( dbExists ) await fs . unlink ( dbPath )
7+ await fs . unlink ( dbPath ) . catch ( ( ) => { } )
138
149 const db = DB . getInstance ( dbPath )
1510
16- // Helper to run raw SQL (DB class does not expose this, so we use createTag etc. for clearing)
17- // We'll clear by deleting all entries via getEntries/getTags and deleteEntry/deleteTag
18-
1911 // Delete all entry_tags by deleting entries and tags (should cascade if foreign keys are set)
2012 const entries = await db . getEntries ( )
2113 for ( const entry of entries ) {
Original file line number Diff line number Diff line change @@ -4,18 +4,10 @@ import { DB } from './index.js'
44
55async function seed ( ) {
66 const dbPath = path . join ( process . cwd ( ) , 'db.sqlite' )
7- const dbExists = await fs . stat ( dbPath ) . then (
8- ( ) => true ,
9- ( ) => false ,
10- )
11- // delete the db file if it exists
12- if ( dbExists ) await fs . unlink ( dbPath )
7+ await fs . unlink ( dbPath ) . catch ( ( ) => { } )
138
149 const db = DB . getInstance ( dbPath )
1510
16- // Helper to run raw SQL (DB class does not expose this, so we use createTag etc. for clearing)
17- // We'll clear by deleting all entries via getEntries/getTags and deleteEntry/deleteTag
18-
1911 // Delete all entry_tags by deleting entries and tags (should cascade if foreign keys are set)
2012 const entries = await db . getEntries ( )
2113 for ( const entry of entries ) {
Original file line number Diff line number Diff line change @@ -4,18 +4,10 @@ import { DB } from './index.js'
44
55async function seed ( ) {
66 const dbPath = path . join ( process . cwd ( ) , 'db.sqlite' )
7- const dbExists = await fs . stat ( dbPath ) . then (
8- ( ) => true ,
9- ( ) => false ,
10- )
11- // delete the db file if it exists
12- if ( dbExists ) await fs . unlink ( dbPath )
7+ await fs . unlink ( dbPath ) . catch ( ( ) => { } )
138
149 const db = DB . getInstance ( dbPath )
1510
16- // Helper to run raw SQL (DB class does not expose this, so we use createTag etc. for clearing)
17- // We'll clear by deleting all entries via getEntries/getTags and deleteEntry/deleteTag
18-
1911 // Delete all entry_tags by deleting entries and tags (should cascade if foreign keys are set)
2012 const entries = await db . getEntries ( )
2113 for ( const entry of entries ) {
Original file line number Diff line number Diff line change @@ -4,18 +4,10 @@ import { DB } from './index.js'
44
55async function seed ( ) {
66 const dbPath = path . join ( process . cwd ( ) , 'db.sqlite' )
7- const dbExists = await fs . stat ( dbPath ) . then (
8- ( ) => true ,
9- ( ) => false ,
10- )
11- // delete the db file if it exists
12- if ( dbExists ) await fs . unlink ( dbPath )
7+ await fs . unlink ( dbPath ) . catch ( ( ) => { } )
138
149 const db = DB . getInstance ( dbPath )
1510
16- // Helper to run raw SQL (DB class does not expose this, so we use createTag etc. for clearing)
17- // We'll clear by deleting all entries via getEntries/getTags and deleteEntry/deleteTag
18-
1911 // Delete all entry_tags by deleting entries and tags (should cascade if foreign keys are set)
2012 const entries = await db . getEntries ( )
2113 for ( const entry of entries ) {
Original file line number Diff line number Diff line change @@ -4,18 +4,10 @@ import { DB } from './index.js'
44
55async function seed ( ) {
66 const dbPath = path . join ( process . cwd ( ) , 'db.sqlite' )
7- const dbExists = await fs . stat ( dbPath ) . then (
8- ( ) => true ,
9- ( ) => false ,
10- )
11- // delete the db file if it exists
12- if ( dbExists ) await fs . unlink ( dbPath )
7+ await fs . unlink ( dbPath ) . catch ( ( ) => { } )
138
149 const db = DB . getInstance ( dbPath )
1510
16- // Helper to run raw SQL (DB class does not expose this, so we use createTag etc. for clearing)
17- // We'll clear by deleting all entries via getEntries/getTags and deleteEntry/deleteTag
18-
1911 // Delete all entry_tags by deleting entries and tags (should cascade if foreign keys are set)
2012 const entries = await db . getEntries ( )
2113 for ( const entry of entries ) {
Original file line number Diff line number Diff line change @@ -4,18 +4,10 @@ import { DB } from './index.js'
44
55async function seed ( ) {
66 const dbPath = path . join ( process . cwd ( ) , 'db.sqlite' )
7- const dbExists = await fs . stat ( dbPath ) . then (
8- ( ) => true ,
9- ( ) => false ,
10- )
11- // delete the db file if it exists
12- if ( dbExists ) await fs . unlink ( dbPath )
7+ await fs . unlink ( dbPath ) . catch ( ( ) => { } )
138
149 const db = DB . getInstance ( dbPath )
1510
16- // Helper to run raw SQL (DB class does not expose this, so we use createTag etc. for clearing)
17- // We'll clear by deleting all entries via getEntries/getTags and deleteEntry/deleteTag
18-
1911 // Delete all entry_tags by deleting entries and tags (should cascade if foreign keys are set)
2012 const entries = await db . getEntries ( )
2113 for ( const entry of entries ) {
Original file line number Diff line number Diff line change @@ -4,18 +4,10 @@ import { DB } from './index.js'
44
55async function seed ( ) {
66 const dbPath = path . join ( process . cwd ( ) , 'db.sqlite' )
7- const dbExists = await fs . stat ( dbPath ) . then (
8- ( ) => true ,
9- ( ) => false ,
10- )
11- // delete the db file if it exists
12- if ( dbExists ) await fs . unlink ( dbPath )
7+ await fs . unlink ( dbPath ) . catch ( ( ) => { } )
138
149 const db = DB . getInstance ( dbPath )
1510
16- // Helper to run raw SQL (DB class does not expose this, so we use createTag etc. for clearing)
17- // We'll clear by deleting all entries via getEntries/getTags and deleteEntry/deleteTag
18-
1911 // Delete all entry_tags by deleting entries and tags (should cascade if foreign keys are set)
2012 const entries = await db . getEntries ( )
2113 for ( const entry of entries ) {
Original file line number Diff line number Diff line change @@ -4,18 +4,10 @@ import { DB } from './index.js'
44
55async function seed ( ) {
66 const dbPath = path . join ( process . cwd ( ) , 'db.sqlite' )
7- const dbExists = await fs . stat ( dbPath ) . then (
8- ( ) => true ,
9- ( ) => false ,
10- )
11- // delete the db file if it exists
12- if ( dbExists ) await fs . unlink ( dbPath )
7+ await fs . unlink ( dbPath ) . catch ( ( ) => { } )
138
149 const db = DB . getInstance ( dbPath )
1510
16- // Helper to run raw SQL (DB class does not expose this, so we use createTag etc. for clearing)
17- // We'll clear by deleting all entries via getEntries/getTags and deleteEntry/deleteTag
18-
1911 // Delete all entry_tags by deleting entries and tags (should cascade if foreign keys are set)
2012 const entries = await db . getEntries ( )
2113 for ( const entry of entries ) {
Original file line number Diff line number Diff line change @@ -4,18 +4,10 @@ import { DB } from './index.js'
44
55async function seed ( ) {
66 const dbPath = path . join ( process . cwd ( ) , 'db.sqlite' )
7- const dbExists = await fs . stat ( dbPath ) . then (
8- ( ) => true ,
9- ( ) => false ,
10- )
11- // delete the db file if it exists
12- if ( dbExists ) await fs . unlink ( dbPath )
7+ await fs . unlink ( dbPath ) . catch ( ( ) => { } )
138
149 const db = DB . getInstance ( dbPath )
1510
16- // Helper to run raw SQL (DB class does not expose this, so we use createTag etc. for clearing)
17- // We'll clear by deleting all entries via getEntries/getTags and deleteEntry/deleteTag
18-
1911 // Delete all entry_tags by deleting entries and tags (should cascade if foreign keys are set)
2012 const entries = await db . getEntries ( )
2113 for ( const entry of entries ) {
Original file line number Diff line number Diff line change @@ -4,18 +4,10 @@ import { DB } from './index.js'
44
55async function seed ( ) {
66 const dbPath = path . join ( process . cwd ( ) , 'db.sqlite' )
7- const dbExists = await fs . stat ( dbPath ) . then (
8- ( ) => true ,
9- ( ) => false ,
10- )
11- // delete the db file if it exists
12- if ( dbExists ) await fs . unlink ( dbPath )
7+ await fs . unlink ( dbPath ) . catch ( ( ) => { } )
138
149 const db = DB . getInstance ( dbPath )
1510
16- // Helper to run raw SQL (DB class does not expose this, so we use createTag etc. for clearing)
17- // We'll clear by deleting all entries via getEntries/getTags and deleteEntry/deleteTag
18-
1911 // Delete all entry_tags by deleting entries and tags (should cascade if foreign keys are set)
2012 const entries = await db . getEntries ( )
2113 for ( const entry of entries ) {
You can’t perform that action at this time.
0 commit comments