public inbox for [email protected]  
help / color / mirror / Atom feed
From: Alejandro Román <[email protected]>
To: Simon Connah <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: Database migrations
Date: Sat, 13 Mar 2021 17:04:55 -0500
Message-ID: <[email protected]> (raw)
In-Reply-To: <DZDT1SCFF7_nJRcZylu8tod4dlTmOX1hAuAlselavvkA4HJAFbOUPC_33W7IxDtMdbzQBPYGPN6p0N58SRHjP3D-JuI8CEyRn3xL1VF4t30=@protonmail.com>
References: <DZDT1SCFF7_nJRcZylu8tod4dlTmOX1hAuAlselavvkA4HJAFbOUPC_33W7IxDtMdbzQBPYGPN6p0N58SRHjP3D-JuI8CEyRn3xL1VF4t30=@protonmail.com>

Hello,

> I was thinking about just having a bunch of SQL files with a version number and date and applying them to the database from oldest to newest (with a table storing information for files that have already been processed). Does this sound like a reasonable solution?

It does. Actually, there is a known JS library that does exactly that: Knex.js (1). It allows you to define your SQL in plain JS (e.g. `knex.schema.createTable(‘users’, …)`). It will then keep track of which migrations (JS files) have been ran and which need to be run. It stores this metadata in a table called “migrations” (you can configure the exact name).

(1) http://knexjs.org/#Migrations

Best wishes,

Alejandro






view thread (7+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Database migrations
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox