Sha256: c969b35d0d526fe14b0fd2e997d225207bcb0145534544b8027e2756997e5453
Contents?: true
Size: 523 Bytes
Versions: 27
Compression:
Stored size: 523 Bytes
Contents
class LinkProjectsAndMaintainers < ActiveRecord::Migration def up create_table :projects_maintainers, :id => false do |t| t.references :project, :user end add_index :projects_maintainers, [:project_id, :user_id], :unique => true admins = User.where(role: "Administrator") Project.unscoped do Project.all.each do |project| admins.each do |admin| project.maintainers << admin end end end end def down drop_table :projects_maintainers end end
Version data entries
27 entries across 27 versions & 1 rubygems