Skip to content

Commit

Permalink
Updated the model for adding unique key constrain on netid Refs #stor…
Browse files Browse the repository at this point in the history
…y/16200
  • Loading branch information
AshviniKabadi committed Jan 7, 2025
1 parent f4be177 commit 976c50d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions app/models/acknowledged_user.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
class AcknowledgedUser < ApplicationRecord
has_many :acknowledgments, dependent: :destroy
validates :netid, presence: true, uniqueness: true
end
2 changes: 1 addition & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Application < Rails::Application
# These settings can be overridden in specific environments using the files
# in config/environments, which are processed later.
#
# config.time_zone = "Central Time (US & Canada)"
config.time_zone = 'Mountain Time (US & Canada)'
# config.eager_load_paths << Rails.root.join("extras")
end
end
4 changes: 3 additions & 1 deletion db/migrate/20241219195633_create_acknowledged_users.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
class CreateAcknowledgedUsers < ActiveRecord::Migration[7.1]
def change
create_table :acknowledged_users do |t|
t.string :netid
t.string :netid, null: false

t.timestamps
end
# Add a unique index to the netid column
add_index :acknowledged_users, :netid, unique: true
end
end
3 changes: 2 additions & 1 deletion db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 976c50d

Please sign in to comment.