{"id":32172967,"url":"https://github.com/midas/phil_columns-ex","last_synced_at":"2026-02-27T01:05:26.462Z","repository":{"id":53104960,"uuid":"61759729","full_name":"midas/phil_columns-ex","owner":"midas","description":"A data seeding framework for Elixir/Ecto.","archived":false,"fork":false,"pushed_at":"2023-03-10T17:48:13.000Z","size":53,"stargazers_count":19,"open_issues_count":4,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-24T05:45:51.158Z","etag":null,"topics":["elixir","seeding"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/midas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-23T00:06:10.000Z","updated_at":"2025-04-24T11:43:33.000Z","dependencies_parsed_at":"2022-09-03T08:23:57.513Z","dependency_job_id":null,"html_url":"https://github.com/midas/phil_columns-ex","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/midas/phil_columns-ex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/midas%2Fphil_columns-ex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/midas%2Fphil_columns-ex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/midas%2Fphil_columns-ex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/midas%2Fphil_columns-ex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/midas","download_url":"https://codeload.github.com/midas/phil_columns-ex/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/midas%2Fphil_columns-ex/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29879925,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-26T23:51:21.483Z","status":"ssl_error","status_checked_at":"2026-02-26T23:50:46.793Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elixir","seeding"],"created_at":"2025-10-21T18:47:33.645Z","updated_at":"2026-02-27T01:05:26.456Z","avatar_url":"https://github.com/midas.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"![PhilColumns: No Fixtures Required](https://raw.githubusercontent.com/midas/phil_columns/master/readme/PhilColumns.png)\n\n# PhilColumns\n\nA full featured Elixir/Ecto seeding solution providing means for dev and prod seeding.\n\n\n## Installation\n\nAdd phil_columns to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [{:phil_columns, \"~\u003e 0.1.0\"}]\nend\n```\n\nEnsure phil_columns is started before your application:\n\n```elixir\ndef application do\n  [applications: [:phil_columns]]\nend\n```\n\nCreate a `Seed` module for you application:\n\n```elixir\n# lib/my_app/seed.ex\n\ndefmodule MyApp.Seed do\n  defmacro __using__(_opts) do\n    quote do\n      use PhilColumns.Seed\n\n      # shared code here ...\n    end\n  end\nend\n```\n\n## Configuration\n\nIf you need to ensure applications are started before seeding, configure them like this:\n\n```elixir\nconfig :phil_columns,\n  ensure_all_started: ~w(timex)a\n```\n\n\n## Usage\n\n### Seeding Quick Start\n\nUse the generator to create a seed.\n\n    $ mix phil_columns.gen.seed add_things\n\nThe generator puts a seed file in place.  Add your seeding logic to the `up/1` and/or `down/1`\nfunctions using any valid Elixir/Ecto code.\n\n```elixir\n# priv/repo/seeds/20160624153032_add_things.exs\n\ndefmodule MyApp.Repo.Seeds.AddThings do\n  use MyApp.Seed\n\n  def up(_repo) do\n    # seeding logic ...\n  end\nend\n```\n\nExecute the seed(s).\n\n    $ mix phil_columns.seed\n\n### The Seed Command\n\nThe simplest usage of the seed command defaults the environment to `dev` and the version to `all`.\n\n    $ mix phil_columns.seed\n\nThe env can be overridden by providing a switch.  The env is used to select only seeds that have been\nspecified for the specified env.\n\n    $ mix phil_columns.seed --env=prod\n    $ mix phil_columns.seed -e prod\n\n### Tags and Environments\n\nTags and environments can be applied to seeds and filtered in command usage.  The seed generator adds the `dev`\nenvironment by default and no tags.  This feature enables efficiency and adaptability in development seeding and\nthe possibility to use _PhilColumns_ seeding in production (see Production Seeding section below).\n\nSpecifying environment(s) for a seed is accomplished with the envs function.\n\n```elixir\ndefmodule MyApp.Repo.Seeds.AddThings do\n  use MyApp.Seed\n\n  envs [:dev, :prod]\n  # ...\nend\n```\n\nTo change the environment use the env switch.  When not specified the env defaults to `dev`.\n\n    $ mix phil_columns.seed -e prod\n\nSimilary, applying tag(s) is accomplished using the tags function.\n\n```elixir\ndefmodule MyApp.Repo.Seeds.AddThings do\n  use MyApp.Seed\n\n  envs [:dev, :prod]\n  tags [:some_tag]\n  # ...\nend\n```\n\nTo change the tag(s) provide them after the command command line.\n\n    $ mix phil_columns.seed --tags=users,settings,etc\n    $ mix phil_columns.seed -t users,settings,etc\n\n\n## Production Seeding\n\n### Why?\n\nSystems often have system level data that must be seeded when bootstraping a system or as new features are rolled out.  Some\nexamples are settings, configurations, roles, licenses, etc.\n\n_PhilColumns_ provides the ability to apply these system data seedings and commit them with features, analgous to an Ecto\nmigration. Committing seed data with features or bug fixes communicates the intention of the data more clearly than any\nother strategy can.\n\n### How?\n\nCreate a module specifically for dealing with seeding in production.\n\n```elixir\ndefmodule MyApp.Deployment.Seeder do\n  import Mix.Ecto\n  import Mix.PhilColumns\n\n  def seed(opts, seeder \\\\ \u0026PhilColumns.Seeder.run/4) do\n    repos = parse_repo(opts)\n            |\u003e List.wrap\n\n    # set env with current_env/0 overwriting provided arg\n    opts = Keyword.put( opts, :env, current_env )\n\n    opts =\n      if opts[:to] || opts[:step] || opts[:all],\n        do: opts,\n        else: Keyword.put(opts, :all, true)\n\n    opts =\n      if opts[:log],\n        do: opts,\n        else: Keyword.put(opts, :log, :info)\n\n    opts =\n      if opts[:quiet],\n        do: Keyword.put(opts, :log, false),\n        else: opts\n\n    Enum.each(repos, fn repo -\u003e\n      exec_task(repo, opts, fn -\u003e\n        seeder.(repo, seeds_path(repo), :up, opts)\n      end)\n    end)\n  end\n\n  defp current_env do\n    # implement this\n    # warning: do not use Mix.env if you are doing an erlang release\n  end\nend\n```\n\nUse the module in the production app's remote console.\n\n```elixir\nMyApp.Deployment.Seeder.seed(tags: ~w(things stuff)a)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmidas%2Fphil_columns-ex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmidas%2Fphil_columns-ex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmidas%2Fphil_columns-ex/lists"}