Underbase

Underbase

  • Docs
  • Guides
  • API
  • GitHub

›Guides

Get started

  • Introduction
  • Installation
  • Configuration
  • Writting migrations
  • Module usage
  • Logging
  • Troubleshooting

Guides

  • Organizing migrations
  • Babel usage
  • Working with backups
  • Typescript usage

API

  • Module
  • Configuration API
  • Query Interface
  • Module for development
Edit

Babel usage

Underbase support third-party compilers to run migrations such as Babel, Typescript and ESM.

See this code example.

Instructions

First, ensure you have the following packages installed :

  • @babel/core
  • @babel/register
  • @babel/preset-env
  • @underbase/cli

Configure your babel.config.js as the following :

module.exports = {
  presets: [
    [
      '@babel/preset-env',
      {
        targets: {
          node: 'current',
        },
      },
    ],
  ],
};

You can then use Babel to transpile migration files on the fly :

underbase --require @babel/register --config underbase.config.js

Babel + Typescript

To use Babel with Typescript, you have to enable .ts extension. In order do that, we've created a package which uses @babel/register.

You still need to have @babel/register and @babel/preset-typescript installed.

See this code example.

Instructions

  1. Install the package
yarn add -D @underbase/babel-register-ts
  1. Then, you can use your Typescript files
underbase -r @underbase/babel-register-ts migrate 1.0
← Organizing migrationsTypescript usage →
  • Instructions
    • Babel + Typescript
Underbase
Guides
Working with backupsWorking with continuous deploymentAPI Reference
Community
Stack OverflowIssues tracker
More
Release notesGitHub