I'm Attila. I'm a senior full-stack freelancer, an ex-Londoner who worked previously for @terracycle, @ubxd and @lastfm. My focus is on high quality output using agile development, Ruby/Rails and JS.


PostgreSQL rubyonrails ActiveRecord

Avoiding PG::NotNullViolation errors when adding new columns in Rails migrations

Posted on .

I have seen this being a common question across newcomers to Rails. When you are adding a new column to an existing table with a non-null constraint, you start writing a migration as follows: This will raise a PG::NotNullViolation error as postgres is smart e…