6
db/migrate/20220527080906_add_reference_for_author_id.rb
Normal file
6
db/migrate/20220527080906_add_reference_for_author_id.rb
Normal file
@@ -0,0 +1,6 @@
|
||||
class AddReferenceForAuthorId < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
remove_column :articles, :author_id, :integer
|
||||
add_reference :articles, :author, foreign_key: { to_table: :users }
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,7 @@
|
||||
class AddIndexOnCategorySlugAndLocale < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :categories, :slug, :string, null: false, default: ''
|
||||
add_index :categories, [:slug, :locale, :portal_id], unique: true
|
||||
change_column_default :categories, :slug, from: '', to: nil
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user