Skip to content

Commit

Permalink
Merge branch 'main' of github.com:FIRSTinMI/db
Browse files Browse the repository at this point in the history
  • Loading branch information
NixFey committed May 11, 2024
2 parents ec73924 + c8e4afe commit bed2696
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 2 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4

# Install the supabase CLI
- uses: supabase/setup-cli@v1

# Test the migrations
- run: supabase db start
23 changes: 23 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Deploy

on:
push:
branches: [ "main" ]
workflow_dispatch:

jobs:
deploy-prod:
runs-on: ubuntu-latest
environment: prod
env:
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
SUPABASE_DB_PASSWORD: ${{ secrets.SUPABASE_DB_PASSWORD }}
# Not strictly speaking a secret, but keep it with everything else
PROJECT_ID: ${{ secrets.SUPABASE_PROJECT_ID }}

steps:
- uses: actions/checkout@v4

- uses: supabase/setup-cli@v1
- run: supabase link --project-ref $PROJECT_ID
- run: supabase db push
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
# db
Database schema(s)
# FiM DB Schema
This repository contains the schema and migrations for the main databased used by FiM internal tooling.

## Working Locally
It's recommended to use the [Supabase CLI](https://supabase.com/docs/guides/cli) to spin up a local database or create new migrations. Please be mindful when creating new migrations that old data in the database may not match your new schema. Run updates on existing data where appropriate to fit it to new schemas.

## CI/CD
Each commit on main or a PR into main will start an action which validates all migrations, then spins up a new database to ensure they apply without error. This action passing is required for a PR to get merged.

Once changes have been merged into main, a trusted repo maintainer can approve a deployment to prod, at which point the changes will go live.

0 comments on commit bed2696

Please sign in to comment.