Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Multiple Ecto Repos

Multiple Ecto Repos

A quick intro to using multiple repos in an Elixir project.

Avatar for Gardo Roman

Gardo Roman

May 29, 2019
Tweet

Other Decks in Technology

Transcript

  1. Why Multiple Repos? • Provides flexibility for structuring projects •

    Allows for separate data solutions:
 - multiple databases
 - different provider (i.e. Postgres, Mongo, etc) • Set privileges specifically for each repos depending on security needs (DDL vs. DML)
  2. Roles • Can be assigned to a single database user

    or a group of users • Can own database objects (tables, functions, etc) • Can assign privileges on those objects to other roles
  3. Grant / Revoke Privileges • Adds / removes privileges to

    or from a database object or a role • Privileges are added to any existing privileges, including:
 - Privileges for that role
 - Privileges for any other roles the user is a member of
 - AND privileges granted to Public
  4. Basic Setup • Entries for each repo in environmental config

    file
 - if adding more than one repo in ecto_repos, 
 then the -r flag must be used when running mix tasks • Add repos to supervisor of Application module • Create file for each repo • Write migration to set privileges for additional repos.