From: | Simon Connah <simon(dot)n(dot)connah(at)protonmail(dot)com> |
---|---|
To: | Alejandro Román <alejandro(at)aroman(dot)sh> |
Cc: | "pgsql-novice(at)lists(dot)postgresql(dot)org" <pgsql-novice(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Database migrations |
Date: | 2021-03-14 09:47:53 |
Message-ID: | iby1tc2lwHM4X4beq2drQsuRckTwVhESXmQOJAUXbfVyGi3TiHc0QdWM6drJ1fS0mtmFe5UtjslMOECkfBnyoqXLTW7aMHy07tBnFGrol1w=@protonmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Saturday, March 13th, 2021 at 22:04, Alejandro Román <alejandro(at)aroman(dot)sh> wrote:
> 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
Hi Alejandro,
Thank you for the information. I'll read through the documentation for that as well. Having everything in JavaScript would be quite helpful in the long run I think but I do like the idea of extensions as well. I'll do some testing and see which option works out best.
Simon.
From | Date | Subject | |
---|---|---|---|
Next Message | bee.lists | 2021-03-15 12:19:04 | Can't Start Server |
Previous Message | Simon Connah | 2021-03-14 09:40:05 | Re: Database migrations |