Skip to content

Commit 717c89c

Browse files
committed
refactor: migrate database update to Cloudflare Worker
1 parent 846fffe commit 717c89c

File tree

6 files changed

+5
-337
lines changed

6 files changed

+5
-337
lines changed

.anima/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
cache

.github/workflows/update-db.yaml

Lines changed: 0 additions & 147 deletions
This file was deleted.

README.md

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ Setup database using:
1313
```bash
1414
npm i
1515
npm run db:migrate -- --local
16-
npm run db:seed
1716
```
1817

18+
Note: Database seeding has been migrated to the [open165-worker](https://github.com/open165/worker) project.
19+
1920
## Start server
2021

2122
First, run the development server:
@@ -40,15 +41,9 @@ This locally builds and previews application using the [Wrangler](https://develo
4041

4142
For more details see the [`@cloudflare/next-on-pages` recommended workflow](https://github.com/cloudflare/next-on-pages/blob/main/internal-packages/next-dev/README.md#recommended-development-workflow)
4243

43-
## Updating scam site DB from 165 open data
44-
45-
```bash
46-
# Fetch opendata and update local DB
47-
npm run db:seed
44+
## Database seeding
4845

49-
# Fetch opendata and update to remote DB. Add --yes to skip confirmation
50-
npm run db:seed -- --remote
51-
```
46+
The scam site database update has been migrated to the [open165-worker](https://github.com/open165/worker) project. Please refer to the worker project's README for more information on the scheduled execution and manual execution of the data sync workflows.
5247

5348
## Making changes to the database schema
5449

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
"gen:env": "wrangler types --env-interface CloudflareEnv env.d.ts",
1414
"gen:migration": "wrangler d1 migrations create open165",
1515
"gen:schema": "wrangler d1 execute open165 --json --command 'SELECT sql FROM sqlite_master' | tsx ./scripts/genSchema.ts",
16-
"predb:seed": "tsx ./scripts/syncSiteRecord.ts && tsx ./scripts/syncSiteAnnouncements.ts",
17-
"db:seed": "wrangler d1 execute open165 --file tmp/scamSiteRecord.sql && wrangler d1 execute open165 --file tmp/scamSiteAnnouncement.sql",
1816
"db:migrate": "wrangler d1 migrations apply open165"
1917
},
2018
"dependencies": {

scripts/syncSiteAnnouncements.ts

Lines changed: 0 additions & 72 deletions
This file was deleted.

scripts/syncSiteRecord.ts

Lines changed: 0 additions & 107 deletions
This file was deleted.

0 commit comments

Comments
 (0)