mirror of
https://github.com/chenasraf/snpr.git
synced 2026-05-18 01:39:01 +00:00
Rewrite seeds in SQL to prevent Solr from indexing
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
class Achievement < ActiveRecord::Base
|
||||
attr_accessible :award,:short_name
|
||||
has_many :user_achievements
|
||||
attr_accessible :award,:short_name
|
||||
has_many :user_achievements
|
||||
|
||||
searchable do
|
||||
text :award
|
||||
end
|
||||
searchable do
|
||||
text :award
|
||||
end
|
||||
end
|
||||
|
||||
31
db/seeds.rb
31
db/seeds.rb
@@ -6,17 +6,24 @@
|
||||
# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
|
||||
# Mayor.create(:name => 'Daley', :city => cities.first)
|
||||
#
|
||||
#User.create(:name => "bla", :email => "abc@def.com", :password => "abc", :password_confirmation => "abc", :has_sequence => true)
|
||||
#User.create(:name => 'bla', :email => 'abc@def.com', :password => 'abc', :password_confirmation => 'abc', :has_sequence => true)
|
||||
|
||||
if Achievement.all.length == 0
|
||||
Achievement.create(:award => "Published genotyping", :short_name => "pub_gen")
|
||||
Achievement.create(:award => "Published 10 Mio. SNPs", :short_name => "10_mio")
|
||||
Achievement.create(:award => "Entered first phenotype", :short_name => "1phen")
|
||||
Achievement.create(:award => "Entered 5 additional phenotypes", :short_name => "5phen")
|
||||
Achievement.create(:award => "Entered 10 additional phenotypes", :short_name => "10phen")
|
||||
Achievement.create(:award => "Entered 20 additional phenotypes", :short_name => "20phen")
|
||||
Achievement.create(:award => "Entered 50 additional phenotypes", :short_name => "50phen")
|
||||
Achievement.create(:award => "Entered 100 additional phenotypes", :short_name => "100phen")
|
||||
Achievement.create(:award => "Created a new phenotype", :short_name => "1addphen")
|
||||
Achievement.create(:award => "Created 5 new phenotypes", :short_name => "5addphen")
|
||||
Achievement.create(:award => "Created 10 new phenotypes", :short_name => "10addphen")
|
||||
time = Time.now.utc
|
||||
# Ths is written in SQL to prevent Solr from indexing... *le sigh*
|
||||
Achievement.connection.execute(<<-SQL)
|
||||
INSERT INTO achievements (award, short_name, created_at, updated_at)
|
||||
VALUES
|
||||
('Published genotyping', 'pub_gen', '#{time.iso8601}', '#{time.iso8601}'),
|
||||
('Published 10 Mio. SNPs', '10_mio', '#{time.iso8601}', '#{time.iso8601}'),
|
||||
('Entered first phenotype', '1phen', '#{time.iso8601}', '#{time.iso8601}'),
|
||||
('Entered 5 additional phenotypes', '5phen', '#{time.iso8601}', '#{time.iso8601}'),
|
||||
('Entered 10 additional phenotypes', '10phen', '#{time.iso8601}', '#{time.iso8601}'),
|
||||
('Entered 20 additional phenotypes', '20phen', '#{time.iso8601}', '#{time.iso8601}'),
|
||||
('Entered 50 additional phenotypes', '50phen', '#{time.iso8601}', '#{time.iso8601}'),
|
||||
('Entered 100 additional phenotypes', '100phen', '#{time.iso8601}', '#{time.iso8601}'),
|
||||
('Created a new phenotype', '1addphen', '#{time.iso8601}', '#{time.iso8601}'),
|
||||
('Created 5 new phenotypes', '5addphen', '#{time.iso8601}', '#{time.iso8601}'),
|
||||
('Created 10 new phenotypes', '10addphen', '#{time.iso8601}', '#{time.iso8601}')
|
||||
SQL
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user