From 8d21d169d91629d9ad0d3c9538035c4171c12df7 Mon Sep 17 00:00:00 2001 From: Colin Regourd Date: Wed, 29 May 2024 13:13:16 +0200 Subject: [PATCH] Add reset cron on workflow --- .github/workflows/reset-database.yml | 14 ++++++++++++++ apps/example/package.json | 1 + package.json | 1 + turbo.json | 5 ++++- 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/reset-database.yml diff --git a/.github/workflows/reset-database.yml b/.github/workflows/reset-database.yml new file mode 100644 index 00000000..6a73352c --- /dev/null +++ b/.github/workflows/reset-database.yml @@ -0,0 +1,14 @@ +on: + schedule: + - cron: "0 0 * * *" + +jobs: + reset-db: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Install dependencies + run: yarn install + - name: Reset database + run: yarn reset-database \ No newline at end of file diff --git a/apps/example/package.json b/apps/example/package.json index 9de47c10..6b79bc61 100644 --- a/apps/example/package.json +++ b/apps/example/package.json @@ -8,6 +8,7 @@ "start": "next start", "lint": "next lint", "database": "prisma migrate dev && prisma db seed", + "reset-database": "prisma migrate reset --force && prisma migrate dev && prisma db seed", "postinstall": "prisma generate", "prisma:migrate:dev": "prisma migrate dev", "vercel-build": "prisma generate && prisma migrate deploy && next build", diff --git a/package.json b/package.json index d3d23a7c..b3c63eb8 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "test": "turbo run test", "test:e2e": "dotenv turbo test:e2e", "database": "dotenv turbo run database", + "reset-database": "dotenv turbo run reset-database", "format": "prettier --write \"**/*.{ts,tsx,md}\"", "publish-package": "yarn build:next-admin && changeset publish", "changeset-version": "(changeset version) && cp packages/next-admin/CHANGELOG.md apps/docs/pages/changelog/index.md" diff --git a/turbo.json b/turbo.json index e0241136..fca7e7a2 100644 --- a/turbo.json +++ b/turbo.json @@ -19,6 +19,9 @@ "test": {}, "test:coverage": {}, "test:e2e": {}, - "database": {} + "database": {}, + "reset-database": { + "cache": false + } } }