Moped Documentation
  • Welcome 👋
  • User Guides
    • Getting started
    • Map a project
  • Product Management
    • User communication
    • User management
    • User analytics
    • Local testing
    • Release process
    • Patch release process
    • MUI X Pro License
    • Integrations
      • Dataset documentation
      • ArcGIS Online
      • eCapris
      • Power BI
    • Features
  • Dev Guides
    • DB Docs & Data dictionary
    • Database backup policy
    • Moped Read Replica
    • How-to's
      • How do I start the Hasura cluster locally?
      • How do I launch the Hasura Console?
      • How do I get a JWT token?
      • How to ping the GraphQL API
      • How to ping the REST API
      • How do I connect a database with Postgres GUIs?
      • How do I connect to the RDS instance?
      • How to load production data into a local instance
      • How do I update seed data?
    • Hasura
      • Hasura Roles
      • Hasura Migrations
        • Getting Started
        • Installing the Hasura CLI
        • Configuration Files
        • Hasura Migration Principles
        • The Migration file format
        • Development
        • Hasura Seed Data
        • Running the Hasura Cluster Locally (video)
        • Create a migration: Exercise 1 (video)
        • Create a migration: Exercise 2 (video)
        • Latest hasura-cluster features
    • User Management
    • Authentication
      • Authentication Architecture
      • DynamoDB & Cognito
      • Secrets Manager & Cognito
      • Hasura & Cognito
      • React & Cognito
      • Flask API & Cognito
      • Single Sign-On with CTM
    • Code organization
    • API
      • Configuration Files
      • Testing
      • User Management API
    • Maps and geospatial data
      • Access tokens and API keys
      • Map libraries
      • Map data
      • Map styles
      • Map layers and basemaps
      • React patterns
      • V1 Archive
        • Map libraries
        • Map data
        • Map custom hooks
        • Map styles
        • Map layers and basemaps
    • UI access control
    • Design system
      • Branding
      • Component styles
      • Text content
    • Activity Log
      • Architecture
      • GitHub Actions and Deployment of Updates
      • Hasura Event Logs and Truncate Cron Job
      • Authentication
  • See also
  • Get Moped support, report a bug, or request an enhancement
  • Data & Technology Services
  • Github repository
Powered by GitBook
On this page

Was this helpful?

  1. Dev Guides
  2. Hasura
  3. Hasura Migrations

Development

Before you get started creating migrations, make sure you have read the entirety of the documentation prior to this section.

DANGER ZONE: Migrations are developed in the local host only. You do not apply migrations directly against staging or production. Those migrations are applied solely by the DevOps pipeline via CircleCI or GitHub Actions.

Migration Development in your machine

Branching in localhost is the only way to safely develop migrations.

To create or review a migration:

  1. Create a branch (git branch your-branch-name). If you are reviewing a migration, update and check out the branch (git checkout the-branch-name).

  2. Run the local hasura cluster, enter ./hasura-cluster start and wait until you see a "migrations finished" message.

  3. Once the servers are ready, you may run ./hasura-cluster console or hasura console. Proceed to make changes to the database, then generate the new migration files.

  4. If you are reviewing the branch, you may do so here. Make sure there are no errors in the terminal, and that the functionality is there.

  5. Save and commit your migration files, then push your changes to your branch in github and make it a PR (no worries, PRs in the database are ignored/not built). If you are reviewing, here is where you make your observations and provide your approval if merited.

  6. Wait until another dev downloads your branch, applies your migrations and makes sure it is safe to be merged to staging.

Once the PR branch is reviewed, then it can be merged to master where CircleCI will run the new migration against staging. If the PR is merged against production, then CircleCI will do its thing against production.

PreviousThe Migration file formatNextHasura Seed Data

Last updated 4 years ago

Was this helpful?