Skip to content

Self-hosted project management for devs and their clients: tickets, time tracking, docs and meetings, with an AI assistant that cites its sources. AGPL-3.0.

Add the two user columns in one table change

Guido Boyked8edac6e1e07
diff --git a/db/migrate/20261029150000_add_email_visibility_to_users.rb b/db/migrate/20261029150000_add_email_visibility_to_users.rb
index b1b47c5..f958651 100644
--- a/db/migrate/20261029150000_add_email_visibility_to_users.rb
+++ b/db/migrate/20261029150000_add_email_visibility_to_users.rb
@@ -7,9 +7,10 @@
# so the users table is not rewritten.
class AddEmailVisibilityToUsers < ActiveRecord::Migration[8.1]
def change
- add_column :users, :email_visibility, :string, null: false, default: 'login'
- add_column :users, :contact_email, :string
- add_check_constraint :users, "email_visibility IN ('login', 'contact', 'none')",
- name: 'users_email_visibility_known'
+ change_table :users, bulk: true do |t|
+ t.string :email_visibility, null: false, default: 'login'
+ t.string :contact_email
+ t.check_constraint "email_visibility IN ('login', 'contact', 'none')", name: 'users_email_visibility_known'
+ end
end
end
diff --git a/spec/requests/user_preferences_email_visibility_spec.rb b/spec/requests/user_preferences_email_visibility_spec.rb
index 89dbed1..7a49f0a 100644
--- a/spec/requests/user_preferences_email_visibility_spec.rb
+++ b/spec/requests/user_preferences_email_visibility_spec.rb
@@ -23,7 +23,7 @@ RSpec.describe 'User preferences: the email the others see', :ci_guard, type: :r
User::EmailDisplay::EMAIL_VISIBILITIES.each do |choice|
expect(response.body).to include(%(value="#{choice}"))
expect(response.body).to include(CGI.escapeHTML(I18n.t("user_preferences.edit.display.email_visibility.#{choice}",
- email: '[email protected]')))
+ email: '[email protected]')))
end
expect(response.body).to include('name="user[contact_email]"')
expect(response.body).to include('value="login" checked="checked"')