JohanObrink / rethink-migrate

A migration tool for rethink db
MIT License
47 stars 24 forks source link

Create schema after running migrations #8

Open Schniz opened 8 years ago

Schniz commented 8 years ago

hey man! love this one! I think that creating a _schema.json file to just create the DB as is (instead of creating and running every step) can be a great feature. then, calling rethink-migrate create-db or something like Rails' migration can be awesome.

Schniz commented 8 years ago

As @danielmewes replied on Twitter, since 2.2 we can query the index functions

Schniz commented 8 years ago

rethink-migrate seed-db is an option too. lets say you have this structure:

- migrations/
  - 20150301163012_some_migration.js
  - seed/
    - users.json
    - products.json

and then when migrating just r.table(tableName).insert(require(tableName+".json")) for every json file

Schniz commented 8 years ago

this will help you speed up testing:

I used some bash and node scripts for it. but we can put all these scripts into this package.

JohanObrink commented 8 years ago

The first thing I built was actually a tool to generate a RethinkDB from a schema, with seed and all. Then I realised that it would be more powerful to make a migration tool so that the db can be handled after first release as well.

To your point though, a quick gen tool could be useful but I think this would be better implemented as helper methods on top of the regular API.

Right now the main focus is to tweak it so that rethinkdb-dash can be used and test for generation in clusters. But after that, I'll look at your suggestions :smile:

Schniz commented 8 years ago

Will you accept a pull request providing these features?

JohanObrink commented 8 years ago

I will accept any good pull request as long as it doesn't muddle up the api och generalize the package too much :smile:

Submit it and I'll look at it as soon as I can - I'm currently trying to fix migrations using rethinkdbdash and clusters but I can hopefully find som time during the weekend.

Thanks!