Skip to content

annatel/padlock

Repository files navigation

Padlock

GitHub Workflow Status GitHub issues License Hex.pm Hex.pm

Create a mutex

Installation

Padlock is published on Hex.
The package can be installed by adding padlock to your list of dependencies in mix.exs:

def deps do
  [
    {:padlock, "~> 0.2.0"}
  ]
end

After the packages are installed you must create a database migration for each version to add the padlock tables to your database.

For mutexes:

defmodule Padlock.TestRepo.Migrations.CreatePadlockTables do
  use Ecto.Migration

  def up do
    Padlock.Mutexes.Migrations.V1.up()
  end

  def down do
    Padlock.Mutexes.Migrations.V1.down()
  end
end

For soft_lock:

defmodule Padlock.TestRepo.Migrations.CreatePadlockTables do
  use Ecto.Migration

  def up do
    Padlock.SoftLock.Migration.up()
  end

  def down do
    Padlock.SoftLock.Migration.down()
  end
end

This will run all of Padlock's versioned migrations for your database. Migrations between versions are idempotent and will never change after a release. As new versions are released you may need to run additional migrations.

Now, run the migration to create the table:

mix ecto.migrate

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages