Cleanup contrib.md, mv seed data to data dir
This commit is contained in:
parent
4027bab5fb
commit
12ae2f5979
5 changed files with 18 additions and 7 deletions
|
@ -14,8 +14,16 @@
|
||||||
- Drizzle
|
- Drizzle
|
||||||
- DrizzleKit
|
- DrizzleKit
|
||||||
|
|
||||||
### Updating Data
|
### Updating the Database (DB)
|
||||||
|
|
||||||
Data is stored in `./db.sqlite`
|
Data is stored in `./db.sqlite`, **but do not modify that file manually.**
|
||||||
|
|
||||||
To update it, modify the files in `./src/db` and run `bun src/db/index.ts`.
|
### To update the data within the tables
|
||||||
|
|
||||||
|
Update the files in `./src/db/data`
|
||||||
|
Then run `bun drizzle-kit push`
|
||||||
|
|
||||||
|
### To update the schema
|
||||||
|
|
||||||
|
Update the file in `./src/schema.ts`
|
||||||
|
Then run `bun src/db/index.ts`
|
||||||
|
|
4
src/db/data/index.ts
Normal file
4
src/db/data/index.ts
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
import publishers from './publishers'
|
||||||
|
import sources from './sources'
|
||||||
|
|
||||||
|
export { publishers, sources }
|
|
@ -1,4 +1,4 @@
|
||||||
import { publisherTable } from './schema';
|
import { publisherTable } from '../schema';
|
||||||
|
|
||||||
type Publisher = typeof publisherTable.$inferInsert;
|
type Publisher = typeof publisherTable.$inferInsert;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { sourceTable } from './schema';
|
import { sourceTable } from '../schema';
|
||||||
|
|
||||||
type Source = typeof sourceTable.$inferInsert;
|
type Source = typeof sourceTable.$inferInsert;
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
import 'dotenv/config';
|
import 'dotenv/config';
|
||||||
import { drizzle } from 'drizzle-orm/bun-sqlite';
|
import { drizzle } from 'drizzle-orm/bun-sqlite';
|
||||||
import { publisherTable, sourceTable } from './schema';
|
import { publisherTable, sourceTable } from './schema';
|
||||||
import publishers from './publishers';
|
import { publishers, sources } from './data'
|
||||||
import sources from './sources';
|
|
||||||
|
|
||||||
const db = drizzle({ connection: { source: process.env.DB_FILE_NAME! } });
|
const db = drizzle({ connection: { source: process.env.DB_FILE_NAME! } });
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue