How to intergate Ecto with an existing PostgreSQL Database

Good Morning, I have a Django app that populates a postgreSQL database from django admin, I am creating an API microservice in elixir to read from the postgreSQL database, but as soon as I type the schema and try to run the server using mix phx.server gives me this error: ERROR 42P07 (duplicate_table) relation "opac_libro_legacy" already exists. I found two packages

  1. ecto_generator | Hex (Retired)

  2. Ecto Generator (gives me error with submodules when installing)

Is there any other elixir package to integrate an exixting database to a new elixir codebase (something like django-admin inspectdb in django).

Thank you so much in advance.

Hi @eddyraz welcome! This sounds like you added a migration in addition to adding the schema. If you already have the tables in the database you shouldn’t create any migrations in Elixir, just type out the schemas for the tables you want to interact with.


Thanks su much, that was the solution.