Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to create a table for existing database #54

Open
jmerriweather opened this issue Aug 2, 2016 · 1 comment
Open

How to create a table for existing database #54

jmerriweather opened this issue Aug 2, 2016 · 1 comment

Comments

@jmerriweather
Copy link

jmerriweather commented Aug 2, 2016

I'm trying to create a table in an existing database using exrm's release tasks. How is everyone else doing this? I'm doing it the following way:

def create_table(production_node, database, table_name) do
  {:ok, _} = Application.ensure_all_started(:app)

  # create table
  table_name.create(disk: [production_node])

  IO.puts "Waiting"
  :ok = database.wait(15000)

  IO.puts "Done"
  :init.stop()
end

Could we perhaps put something like this in the readme? Assuming this is correct, should I send a PR?

@jmerriweather
Copy link
Author

jmerriweather commented Apr 10, 2017

Just wanted to add, don't destroy the metadata. Will reset any indexes.

Updated above comment to remove the following:

 # get metadata for database
  metadata = Amnesia.Metadata.for(database)
  # destroy database metadata table
  metadata |> Amnesia.Metadata.destroy
  # create metadata table
  metadata |> Amnesia.Metadata.create(disk: [production_node])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant