caslu

caslu

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:

$ mix phx.gen.schema Blog.Post blog_posts title:string! views:integer!

and the current output would be generated:

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.

Showing Posts 1 to 6

rhcarvalho

rhcarvalho

It’s a reasonable feature. I occasionally add null: false after generating migrations.

Let’s hear what other people think.

If you have buy-in from the Phoenix team I can help you both suggesting pointers for where to look at in the code base as well a reviewing a PR.

dimitarvp

dimitarvp

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.

caslu

caslu OP

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 :waving_hand:

caslu

caslu OP

Thanks bro, i think would be great to have this feature cause we’ll be able to generate almost everything in migration only using mix phx task.

I’d really love this help, would be very welcome mate :saluting_face:

rhcarvalho

rhcarvalho

(If your driving motivation is to contribute something, and you are interested in the code generators, this open issue might serve as a good entrypoint to the topic Calling phx.mix.gen without specifying attributes will succeed but create broken code · Issue #5870 · phoenixframework/phoenix · GitHub)

caslu

caslu OP

Gonna take a look bro, i’m really looking forward code contribution in phoenix. Can i send you a DM in forum chat ?

— All posts loaded —

Where Next? Top

Trending in Proposals: Ideas Top

woylie
We are seeing a lot of warning logs like this: navigate event to "https://someurl" failed because you are redirecting across live_sessio...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews