Open cs-victor-nascimento opened 8 years ago
Sounds good to me, go for it :+1:
Just so I get this right, I will use the following default values:
Drop task will accept an option --no-schema to destroy only the database. Defaults to false destroying also the schema.
Also, to make it easier to detect that the module is an amnesia database, I think we should add an __amnesia__/0
function. What do you think?
Migrate will probably go in a different PR...
How would that function be used?
Much like this line in Mix.Ecto.
I can also detect if the module has a defdatabase!/2 function... I guess it is not necessary to introduce a new function...
Actually I will call metadata and check it returns a %Amnesia.Metadata{database: module}
.
[x] - Create mix task [x] - Drop mix task [ ] - Migrate mix task
Hello guys,
First of, #42
Second, if these new and shiny mix tasks are part of the official readme on the front page, they should also be part of the latest release people get when they install amnesia using hex. So maybe we should create a new release with the current master?
@matehat released a new version.
:+1:
I think it would help a lot to have some default mix tasks like create|drop|migrate (same as those found in ecto for easier understanding). Your example of install/uninstall in the README is pretty much what everybody does when starting a project with amnesia INMHO.
We would only need to support something like:
Options I can think of are:
--no-schema
: would not create the mnesia schema--disc
: would create passing the option disc:[node()]--disc-only
: same as above but with disc only on node ... and other mnesia options.To support migrate we could have some behaviour that would export a migrate function and we would receive the user module implementing that function. Again, close to Ecto's idiom.
I was starting out a PR but thought that it would be better to ask for opinions first. What do you think @meh?