Skip to content

Commit

Permalink
Set column to not null AFTER setting default value in migration
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent-truong-main authored and dorner committed Feb 8, 2024
1 parent f8caf36 commit 6312a8a
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 91 deletions.
56 changes: 28 additions & 28 deletions app/models/organization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,34 @@
#
# Table name: organizations
#
# id :integer not null, primary key
# city :string
# deadline_day :integer
# default_storage_location :integer
# distribute_monthly :boolean default(FALSE), not null
# email :string
# enable_child_based_requests :boolean default(TRUE), not null
# enable_individual_requests :boolean default(TRUE), not null
# enable_quantity_based_requests :boolean default(TRUE), not null
# intake_location :integer
# invitation_text :text
# latitude :float
# longitude :float
# name :string
# partner_form_fields :text default([]), is an Array
# reminder_day :integer
# repackage_essentials :boolean default(FALSE), not null
# short_name :string
# state :string
# street :string
# url :string
# one_step_partner_invite :boolean default(FALSE), not null
# ytd_on_distribution_printout :boolean default(TRUE), not null
# zipcode :string
# created_at :datetime not null
# updated_at :datetime not null
# account_request_id :integer
# ndbn_member_id :bigint
# id :integer not null, primary key
# city :string
# deadline_day :integer
# default_storage_location :integer
# distribute_monthly :boolean default(FALSE), not null
# email :string
# enable_child_based_requests :boolean default(TRUE), not null
# enable_individual_requests :boolean default(TRUE), not null
# enable_quantity_based_requests :boolean default(TRUE), not null
# intake_location :integer
# invitation_text :text
# latitude :float
# longitude :float
# name :string
# one_step_partner_invite :boolean default(FALSE), not null
# partner_form_fields :text default([]), is an Array
# reminder_day :integer
# repackage_essentials :boolean default(FALSE), not null
# short_name :string
# state :string
# street :string
# url :string
# ytd_on_distribution_printout :boolean default(TRUE), not null
# zipcode :string
# created_at :datetime not null
# updated_at :datetime not null
# account_request_id :integer
# ndbn_member_id :bigint
#

class Organization < ApplicationRecord
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class AddOneStepPartnerInviteToOrganization < ActiveRecord::Migration[7.0]
def change
safety_assured do
add_column :organizations, :one_step_partner_invite, :boolean, default: false, null: false
end
end
end
2 changes: 1 addition & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.0].define(version: 2024_01_31_202431) do
ActiveRecord::Schema[7.0].define(version: 2024_02_07_202431) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"

Expand Down
56 changes: 28 additions & 28 deletions spec/factories/organizations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,34 @@
#
# Table name: organizations
#
# id :integer not null, primary key
# city :string
# deadline_day :integer
# default_storage_location :integer
# distribute_monthly :boolean default(FALSE), not null
# email :string
# enable_child_based_requests :boolean default(TRUE), not null
# enable_individual_requests :boolean default(TRUE), not null
# enable_quantity_based_requests :boolean default(TRUE), not null
# intake_location :integer
# invitation_text :text
# latitude :float
# longitude :float
# name :string
# partner_form_fields :text default([]), is an Array
# reminder_day :integer
# repackage_essentials :boolean default(FALSE), not null
# short_name :string
# state :string
# street :string
# url :string
# one_step_partner_invite :boolean default(FALSE), not null
# ytd_on_distribution_printout :boolean default(TRUE), not null
# zipcode :string
# created_at :datetime not null
# updated_at :datetime not null
# account_request_id :integer
# ndbn_member_id :bigint
# id :integer not null, primary key
# city :string
# deadline_day :integer
# default_storage_location :integer
# distribute_monthly :boolean default(FALSE), not null
# email :string
# enable_child_based_requests :boolean default(TRUE), not null
# enable_individual_requests :boolean default(TRUE), not null
# enable_quantity_based_requests :boolean default(TRUE), not null
# intake_location :integer
# invitation_text :text
# latitude :float
# longitude :float
# name :string
# one_step_partner_invite :boolean default(FALSE), not null
# partner_form_fields :text default([]), is an Array
# reminder_day :integer
# repackage_essentials :boolean default(FALSE), not null
# short_name :string
# state :string
# street :string
# url :string
# ytd_on_distribution_printout :boolean default(TRUE), not null
# zipcode :string
# created_at :datetime not null
# updated_at :datetime not null
# account_request_id :integer
# ndbn_member_id :bigint
#

FactoryBot.define do
Expand Down
56 changes: 28 additions & 28 deletions spec/models/organization_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,34 @@
#
# Table name: organizations
#
# id :integer not null, primary key
# city :string
# deadline_day :integer
# default_storage_location :integer
# distribute_monthly :boolean default(FALSE), not null
# email :string
# enable_child_based_requests :boolean default(TRUE), not null
# enable_individual_requests :boolean default(TRUE), not null
# enable_quantity_based_requests :boolean default(TRUE), not null
# intake_location :integer
# invitation_text :text
# latitude :float
# longitude :float
# name :string
# partner_form_fields :text default([]), is an Array
# reminder_day :integer
# repackage_essentials :boolean default(FALSE), not null
# short_name :string
# state :string
# street :string
# url :string
# one_step_partner_invite :boolean default(FALSE), not null
# ytd_on_distribution_printout :boolean default(TRUE), not null
# zipcode :string
# created_at :datetime not null
# updated_at :datetime not null
# account_request_id :integer
# ndbn_member_id :bigint
# id :integer not null, primary key
# city :string
# deadline_day :integer
# default_storage_location :integer
# distribute_monthly :boolean default(FALSE), not null
# email :string
# enable_child_based_requests :boolean default(TRUE), not null
# enable_individual_requests :boolean default(TRUE), not null
# enable_quantity_based_requests :boolean default(TRUE), not null
# intake_location :integer
# invitation_text :text
# latitude :float
# longitude :float
# name :string
# one_step_partner_invite :boolean default(FALSE), not null
# partner_form_fields :text default([]), is an Array
# reminder_day :integer
# repackage_essentials :boolean default(FALSE), not null
# short_name :string
# state :string
# street :string
# url :string
# ytd_on_distribution_printout :boolean default(TRUE), not null
# zipcode :string
# created_at :datetime not null
# updated_at :datetime not null
# account_request_id :integer
# ndbn_member_id :bigint
#

RSpec.describe Organization, type: :model do
Expand Down

0 comments on commit 6312a8a

Please sign in to comment.