Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Object lists package #230

Merged
merged 26 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
c4b0872
create object-lists package
barbarah Sep 8, 2023
5f3ca23
Add GitHub actions for database migrations
barbarah Sep 9, 2023
de4fbab
Add documentation about connection to the database
barbarah Sep 10, 2023
c8492d0
Minor changes (renames, typos, etc)
barbarah Sep 13, 2023
a46c218
Update database github actions
barbarah Sep 14, 2023
7bb20a9
Rename package and update readme
barbarah Sep 14, 2023
3993c62
Update database schema
barbarah Sep 14, 2023
fb10974
Use `dotenv-cli` to load environment variables
barbarah Sep 15, 2023
10672fd
Create separate database migrations for the separate tables
barbarah Sep 15, 2023
fbb81cc
Move DATABASE_MODE to environment variable
barbarah Sep 15, 2023
6aad807
Validate database insert with drizzle-zod
barbarah Sep 15, 2023
bb954e6
Move object-list actions to one exported object
barbarah Sep 16, 2023
28d77ed
Rename package to @colonial-collections/database
barbarah Sep 19, 2023
caace04
Update database schema and migrations
barbarah Sep 19, 2023
56ff837
rename functions
barbarah Sep 19, 2023
412a8d0
Add a db:create script
barbarah Sep 19, 2023
34372e6
Update readme
barbarah Sep 19, 2023
777dfa3
Update package-lock.json
barbarah Sep 19, 2023
97a827b
Rename 'datahub-data' to 'database' everywhere
barbarah Sep 19, 2023
bdb6b18
Move database migration to separate script
barbarah Sep 20, 2023
adc0058
Add object hash (md5) to schema
barbarah Sep 21, 2023
0d659cf
Chaged `objectHash` to `id`
barbarah Sep 21, 2023
862102f
Minor code review remarks
barbarah Sep 21, 2023
b999ada
minor code review changes
barbarah Sep 21, 2023
017d682
Update database schema
barbarah Sep 21, 2023
960b318
Add comment about bug in drizzle migrations
barbarah Sep 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/database-merge-and-deploy-schema-changes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Merge and deploy database schema changes
on:
pull_request:
branches: ["main"]
types: [closed]
paths: ["packages/database/migrations/**"]

jobs:
merge_changes:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
steps:
- name: checkout
uses: actions/checkout@v4
- name: Create a deploy request
uses: planetscale/create-deploy-request-action@v1
id: create_deploy_request
with:
org_name: colonial-collections
database_name: datahub
branch_name: development
env:
PLANETSCALE_SERVICE_TOKEN_ID: ${{ secrets.PLANETSCALE_SERVICE_TOKEN_ID }}
PLANETSCALE_SERVICE_TOKEN: ${{ secrets.PLANETSCALE_SERVICE_TOKEN }}
- name: Deploy a deploy request
uses: planetscale/deploy-deploy-request-action@v1
with:
org_name: colonial-collections
database_name: datahub
number: ${{ steps.create_deploy_request.outputs.number }}
wait: true
env:
PLANETSCALE_SERVICE_TOKEN_ID: ${{ secrets.PLANETSCALE_SERVICE_TOKEN_ID }}
PLANETSCALE_SERVICE_TOKEN: ${{ secrets.PLANETSCALE_SERVICE_TOKEN }}
30 changes: 30 additions & 0 deletions .github/workflows/database-migrate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Migrate database

on:
pull_request:
branches: ["main"]
paths: ["packages/database/migrations/**"]

jobs:
migrate:
env:
DATABASE_URL: ${{ secrets.PLANETSCALE_DATABASE_URL }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: "18"
- run: npm ci
- run: npm run db:migrate
- name: Add comment
uses: mshick/add-pr-comment@v2
with:
message: |
## Database schema changes have been applied

The development database migrated with the migrations found in this branch.

**Warning**: All preview and development environments use the same database. This migration can affect all preview and development environments.

After merging this pull request, the development database changes will merge into the production database.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ Then run:

docker run --rm -it -v "$PWD":/app -w /app node:18 /bin/bash

### Connecting to the MySQL server

Add `DATABASE_URL` environment variable to the file `apps/researcher/.env.local`. More information about connecting to the database is in the [database readme](packages/database/README.md).

barbarah marked this conversation as resolved.
Show resolved Hide resolved
### Install packages

docker run --rm -it -v "$PWD":/app -w /app node:18 npm install --no-progress
Expand Down
3 changes: 2 additions & 1 deletion apps/researcher/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
},
"dependencies": {
"@clerk/localizations": "1.25.2",
"@clerk/nextjs": "4.21.13",
"@clerk/nextjs": "4.23.2",
"@clerk/types": "3.51.0",
"@colonial-collections/content": "*",
"@colonial-collections/iris": "*",
Expand All @@ -35,6 +35,7 @@
"fetch-sparql-endpoint": "3.3.3",
"next": "13.4.7",
"next-intl": "3.0.0-beta.7",
"@colonial-collections/database": "*",
"openseadragon": "4.1.0",
"rdf-object": "1.14.0",
"react": "18.2.0",
Expand Down
Loading
Loading