dmfay/massive-js

How do I add coordinate Document Tables creation with my migration tool?

vibl opened this issue · 3 comments

vibl commented

I need to add columns to a Document Table. What is the recommended practice to make sure the table has been created (by db.saveDoc('myTable'...)) before running the migration script that will add the columns to it?

I use https://github.com/golang-migrate/migrate, a simple CLI tool that uses SQL files for migration. It doesn't have the ability to execute arbitrary scripts has part of a migration plan (yet: mattes/migrate#171).

dmfay commented

I usually just copy out the document table DDL into my migration scripts if I need to customize them. You'll need to replace the tokens in that file: schema and table should be pretty obvious, index can be whatever you like, and pkType + pkDefault should be either SERIAL and nothing, or UUID and one of the UUID generation functions.

vibl commented

Thanks! I think it would be useful to include it in the doc.

dmfay commented

Migrations are out of scope for Massive, but of course you can publish whatever extensions you like to the registry :) You're right it couldn't hurt to be a little more specific about it in the docs though.