pma / riak_ecto

Riak adapter for Ecto
The Unlicense
31 stars 4 forks source link

About create bucket types with riakc_pb_socket #7

Closed developerworks closed 8 years ago

developerworks commented 8 years ago

I have read the api doc of riakc_pb_socket client library, but can not find the bucket type creation functionalities, i konw i can use the http rest api to create bucket types, i just want to create bucket types just like RDBMS CREATE DATABASE <dbname>

My be the rest api could be added into the repo. give me some ideas, thank you.

pma commented 8 years ago

@developerworks The PB (http://basho.github.io/riak-erlang-client/riakc_pb_socket.html) or HTTP apis do not expose functions to create bucket types. AFAIK, currently the only method is to use the riak-admin command line tool, as described here: https://github.com/pma/riak_ecto/blob/master/examples/simple/README.md

To implement the migration callbacks in the Riak Ecto adapter, an option would be to just shell out riak-admin directly.

As a side note, I'm currently using a bucket type per model, instead of one bucket type per Repo. Found it much easier to implement multitenancy.