Pg-promise: Migrations

Created on 31 Jan 2016  路  5Comments  路  Source: vitaly-t/pg-promise

Hi!

What would be your recommended approach to long-term schema mutations alongside the use of pg-promise? A common approach is, of course, the idea of defining migrations which mutate the schema up and down, along with the concept of the _current_ migration state held in a migrations table.

I don't see any explicit support for this sort of thing in pg-promise. Is that because you explicitly prefer an alternative method or is it that you simply haven't felt the need yourself?

question

Most helpful comment

Well, I suppose I raise this question because I'm learning about the library in conjunction with looking at vitaly-t/pg-promise-demo.

In that project, you do interact with a schema:

https://github.com/vitaly-t/pg-promise-demo/blob/master/db/sql/products/create.sql

I'm just thinking about the use of this library inside a real-world project, and a natural first step is to think about that sort of stuff.

All 5 comments

What migration? :)

This library doesn't even use any notion of a schema. This is not an ORM, it formats and executes generic queries, that's its whole purpose.

Data migration relates to the database architecture, which is outside of this library's purpose.

@leemhenson there are some packages out there that deal with the data migration, like this one: node-postgres-migrate.

Well, I suppose I raise this question because I'm learning about the library in conjunction with looking at vitaly-t/pg-promise-demo.

In that project, you do interact with a schema:

https://github.com/vitaly-t/pg-promise-demo/blob/master/db/sql/products/create.sql

I'm just thinking about the use of this library inside a real-world project, and a natural first step is to think about that sort of stuff.

I understand. And that demo only shows you the best way to organize all your queries and the application structure, if you want to develop a proper product.

Other than that, this framework, as defined, is an advanced promise-based access layer on top of the very basic node-postgres.

There is plenty of documentation to help you understand it better. See it in WiKi.

Yep, makes sense.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Fte-github picture Fte-github  路  4Comments

cortopy picture cortopy  路  5Comments

seanh1414 picture seanh1414  路  4Comments

illarionvk picture illarionvk  路  3Comments

cmelone picture cmelone  路  3Comments