loopbackio / loopbackio/loopback-next

Database Migration Management Framework

Open
#487 23 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature major
Dominant language
TypeScript
Stars
5.1k
Forks
1.1k
Avg merge
2d 21h
Merged PRs (30d)
27

Description

_From @kjdelisle on July 28, 2017 18:37_

## Scenario
FooCorp wants to deploy version 2.0 of their LoopBack application on their production server, but doing so will require some alteration of the schema in their database. Some of these changes require a more delicate touch that cannot necessarily be performed by the `autoupdate` function.

Currently, FooCorp would have to create their own scripts and execute them to modify their database schema to match their expectations, which may require them to more directly interface with drivers that are used by their chosen LoopBack connector, or using another implementation entirely!

## Proposal

Create a component for use in loopback-next that handles the idea of production-system migration within a LoopBack application as it is upgraded from one release to another.

Originally, I had a design in my mind for how this would work, but I noticed that there are some generic migration tools on npm (https://www.npmjs.com/package/migration), and I was wondering if there was anything additional that we'd want to add to make it easier to do this sort of thing.

Martin Fowler's [Evolutionary Database Design](https://www.martinfowler.com/articles/evodb.html) provides a comprehensive information on this topic, including implementation examples.

Other ORM frameworks have been supporting migrations for quite some time, we can inspire from them.
- [Migrations in Ruby on Rails](https://guides.rubyonrails.org/v3.2/migrations.html)
- [.NET EntityFramework's Code First Migrations](https://docs.microsoft.com/en-us/aspnet/mvc/overview/getting-started/getting-started-with-ef-using-mvc/migrations-and-deployment-with-the-entity-framework-in-an-asp-net-mvc-application)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The proposal names no repository files, tests, or entry points. Start by reviewing the migration package idea and the referenced Evolutionary Database Design and ORM migration examples; done would require an agreed production-migration design and its implementation in loopback-next.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, typescript
Domain
backend, databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.