Added description, user_id, user_ip columns to notes

Added migration for adding new columns (description, user_id, user_ip) to notes table. Also, migration adds foreign key connecting notes and users tables (using user_id column).
This commit is contained in:
Nenad Vujicic 2025-01-13 10:52:38 +01:00
parent 5d76ec051e
commit 16bdcac6d7
3 changed files with 37 additions and 9 deletions

View file

@ -0,0 +1,9 @@
class AddDescriptionToNotes < ActiveRecord::Migration[7.2]
def change
add_column :notes, :description, :text, :null => false, :default => ""
add_column :notes, :user_id, :bigint
add_column :notes, :user_ip, :inet
add_foreign_key :notes, :users, :column => :user_id, :name => "notes_user_id_fkey", :validate => false
end
end