Skip to content

Sqitch is a semi-sane way to manage databases. This module here is all about integrating with the power of Sqitch.

Notifications You must be signed in to change notification settings

BenMorganIO/sqitch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sqitch

Sqitch is a semi-sane way to manage databases. This module here is all about integrating with the power of Sqitch.

This project has no dependencies :D

Installation

You can add this package by adding it to your deps in mix.exs:

def deps do
  [
    {:sqitch, "~> 0.1.0", runtime: false,  only: [:dev, :test]}
  ]
end

Ecto

To alias this guy to your Ecto setup we need to do two things.

  1. Tell Sqitch where your sqitch app is located so that we can cd into there and execute commands for you. All options are the same as the System.cmd/2 function.

    # config/dev.exs and config/test.exs
    
    config :sqitch, :system,
      into: IO.stream(:stdio, :line),
      cd: "#{__DIR__}/my_sqitch_app"
  2. Now that the sqitch task knows where to look for your sqitch project we can alias it to ecto.migrate and make running migrations easier for you.

    # mix.exs
    
    defp aliases do
      [
        "ecto.migrate": "sqitch deploy --target #{Mix.env}",
        "ecto.setup": ["ecto.create", "ecto.migrate", "run priv/repo/seeds.exs"],
        "ecto.reset": ["ecto.drop", "ecto.setup"]
      ]
    end

About

Sqitch is a semi-sane way to manage databases. This module here is all about integrating with the power of Sqitch.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages