我使用以下迁移创建了一个表:
class CreateProfilePictures < ActiveRecord::Migration
def change
create_table :profile_pictures do |t|
t.integer :user_id, null: false
t.integer :picture_id, null: false
t.timestamps null: false
end
add_index :profile_pictures, :user_id, unique: true
add_index :profile_pictures, :picture_id, unique: true
end
end
Run Code Online (Sandbox Code Playgroud)
我尝试使用以下内容删除约束:
class FixProfilePic < ActiveRecord::Migration
def change
change_column :profile_pictures, :picture_id, :integer, unique: false
end
end
Run Code Online (Sandbox Code Playgroud)
如果我尝试在多个地方使用相同的picture_id,我仍然会遇到唯一的约束违规错误.从picture_id中删除唯一性约束的正确方法是什么?
当我尝试推送到git并且我不知道如何解决它时,我收到此错误.
Counting objects: 1239, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (1062/1062), done.
Writing objects: 100% (1239/1239), 26.49 MiB | 679.00 KiB/s, done.
Total 1239 (delta 128), reused 0 (delta 0)
remote: warning: File log/development.log is 98.59 MB; this is larger than GitHub's recommended maximum file size of 50.00 MB
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: error: Trace: efd2d13efa4a231e3216dad097ec25d6
remote: error: See http://git.io/iEPt8g for …Run Code Online (Sandbox Code Playgroud) 我有一个奇怪的事情,我关闭了我的终端,但服务器继续运行.当我再次尝试运行服务器时,我收到一条消息,表明服务器仍在运行.我怎么能通过命令行停止服务器?