Recently (last week) this PR was merged in Ruby on Rails repository and i thought it could be nice to have in phoenix, basically what it does is to add a “!” operator at the end of each type, so in summary we would type:
defmodule MyApp.Repo.Migrations.CreateBlogPosts do
use Ecto.Migration
def change do
create table(:blog_posts) do
add :title, :string, null: false
add :views, :integer, null: false
timestamps(type: :utc_datetime)
end
end
end
If you think this make sense as i do and like the idea i think would be great for me to work in this feature since i’m always looking to ways to contribute with code for phoenix, but i would need some help and i’d be really greateful if you guys could help me do it.
IMPORTANT: There’s my first feature suggestion and i don’t know very well how things are done here, sorry if the post does not follow any standard or something like that.
I do like the idea and I believe I’ve seen it in other ecosystems as well. But there must always be kept a balance between over-loading a DSL and the usefulness that the new feature will bring. It’s not a clear win in favor of adding the bang variant.
Thanks for your reply and point of view, so if i got it you meant that’s not worthy to add bang variable in generators right? I can be wrong but In my opinion, this feature is classified as a small change that would help a lot in everyday life of phoenix devs, i already had to generate long schemas and was kind of boring to add null: false in almost every field. Anyway, thanks for your reply