-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated the model for adding unique key constrain on netid Refs #stor…
…y/16200
- Loading branch information
1 parent
f4be177
commit 976c50d
Showing
4 changed files
with
7 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.