Skip to content

A Pow store implementation that uses postgres as the backend

Notifications You must be signed in to change notification settings

newxan/pow_postgres_store

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PowPostgresStore

Implements Pow's Pow.Backend.Store.Base behaviour using a Postgres table.

Installation

First, add the dependency:

def deps do
  [
    {:pow_postgres_store, "~> 1.0"}
    # or 
    {:pow_postgres_store, github: "ZennerIoT/pow_postgres_store}
  ]
end

Run:

$ mix pow.postgres.gen.schema lib/my_app/util/pow_store.ex

to generate the ecto schema as well as the necessary migrations.

Tell pow_postgres_store where to find the ecto repository:

config :pow, Pow.Postgres.Store,
  repo: MyApp.Repo
  # schema: Pow.Postgres.Schema
  # you can use a different name for the schema if you've modified the generated file

and tell pow to use this library as the store:

config :my_app, Pow,  
  cache_store_backend: Pow.Postgres.Store

To automatically delete expired records from the database table, add this somewhere in your supervision tree:

children = [
  #...
  {Pow.Postgres.Store.AutoDeleteExpired, [interval: :timer.hours(1)]},
  #...
]

About

A Pow store implementation that uses postgres as the backend

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Elixir 95.0%
  • HTML 5.0%