UNPKG

596 BJavaScriptView Raw
1'use strict'
2
3module.exports = (migrations) => {
4 const entries = migrations
5
6 return {
7 all: async () => {
8 return entries.map(({ name, content }) => ({ name, content }))
9 },
10 add: async (name, content) => {
11 entries.push({ name, content })
12 },
13 remove: async (name) => {
14 const index = entries.map((entry, position) => [entry, position])
15 .filter(([entry, position]) => entry.name === name)
16 .map(([entry, position]) => position)
17 .shift()
18
19 entries.splice(index, 1)
20 }
21 }
22}