zachdaniel
Ash and AshPostgres generators/installers, built with igniter are available on main!
I’ll be very grateful to anyone willing to give them a shot and report back with there experience.
Keep in mind, things will absolutely break. Not only are these brand new generators, but they are an entirely new kind of generator. For more on igniter, see this thread: Igniter - A code generation and project patching framework
Commands to dive in with!
Install the archive
mix archive.install hex igniter_new
Create a new app and install dependencies into it
We use the github dependencies here so that you can use the new installers, which are only available on main currently.
mix igniter.new app_name \
--install ash@github:ash-project/ash
Or install multiple dependencies at once. iterex in this example doesn’t have an installer (as it doesn’t need one), so it just gets added to the mix.exs file with no other changes
# as a csv
mix igniter.new app_name \
--install iterex,ash@github:ash-project/ash,ash_postgres@github:ash-project/ash_postgres
# in multiple flags
mix igniter.new app_name \
--install iterex \
--install ash@github:ash-project/ash \
--install ash_postgres@github:ash-project/ash_postgres
Or, modify an existing app!
first, add igniter to your mix.exs
defp deps do
[
{:igniter, "~> 0.2"}
]
end
Install dependencies
mix igniter.install ash@github:ash-project/ash
Install dependencies with example code!
mix igniter.install ash@github:ash-project/ash --example
Generate a resource
mix ash.gen.resource Twitter.Tweets.Tweet \
--uuid-primary-key id \
--attribute text:string:required:public
And generate another one, see how the domain is modified to reference the newly created resource?
mix ash.gen.resource Twitter.Tweets.Like \
--uuid-primary-key id \
--relationship belongs_to:tweet:Twitter.Tweets.Tweet:required:public
Generate a resource using a specific extension!
You will want to install ash_postgres first for this to work:
mix igniter.install ash_postgres@github:ash-project/ash_postgres
mix ash.gen.resource Twitter.Tweets.Tweet \
--uuid-primary-key id \
--attribute text:string:required:public
--extend postgres
Modify an existing resource to use a new extension
swap its data layer to use ets
mix ash.extend Twitter.Tweets.Tweet ets
And swap it back to use postgres
mix ash.extend Twitter.Tweets.Tweet postgres
Or add a new extension
mix ash.extend Twitter.Tweets.Tweet Ash.Policy.Authorizer
There are a couple more generators you can play with like mix ash.gen.enum, but I think this is enough to get started.
Happy hacking ![]()
Trending in News & Updates
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 6- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
ghannam80
Got the below error while running :
remote: Enumerating objects: 44617, done.
remote: Counting objects: 100% (1646/1646), done.
remote: Compressing objects: 100% (1099/1099), done.
remote: Total 44617 (delta 613), reused 1544 (delta 536), pack-reused 42971
origin/HEAD set to main
error: invalid path ‘documentation/dsls/DSL:-Ash.DataLayer.Ets.md’
error: invalid path ‘documentation/dsls/DSL:-Ash.DataLayer.Mnesia.md’
error: invalid path ‘documentation/dsls/DSL:-Ash.Domain.md’
error: invalid path ‘documentation/dsls/DSL:-Ash.Notifier.PubSub.md’
error: invalid path ‘documentation/dsls/DSL:-Ash.Policy.Authorizer.md’
error: invalid path ‘documentation/dsls/DSL:-Ash.Reactor.md’
error: invalid path ‘documentation/dsls/DSL:-Ash.Resource.md’
** (Mix) Command “git --git-dir=.git checkout --quiet origin/HEAD” failed
mix deps.get returned exited with code:
1zachdaniel
Interesting…can you please open an issue on the igniter GH repo?
If anyone else is getting that same error please let me know as well.
EDIT: I’m unable to reproduce it. Are you on windows?
ghannam80
Yes , i am on Windows 11
zachdaniel
Hmm…I think this issue is unrelated to igniter in that case. If you were to make a fresh project and point a mix dependency at github, you’d likely encounter this same issue. You’ll probably need to wait until we release proper hex version to try these out in that case, sorry about that
albin
Congrats on the beta release
Tried using uuidv7 with
--uuid-v7-primary-key idbut noticed that it fails silently, and generates a resource without a primary key.Then noticed that it also silently ignores any unknown/typo-ed parameters
Could you make it error out instead of silently ignoring unknown params in this case?
TIA
zachdaniel
This is actually kind of a tough one because of the way that we pass arguments down into nested generators
I will see what I can do 