Add importer model, validations to paper model

This commit is contained in:
Andreas Haller 2015-05-17 17:49:09 +02:00
parent 568abb631f
commit 46de026234
8 changed files with 67 additions and 13 deletions

View file

@ -5,6 +5,7 @@ class CreatePapers < ActiveRecord::Migration
t.string :url
t.string :reference
t.string :name
t.string :body
t.datetime :published_at
t.datetime :scraped_at
t.string :paper_type
@ -14,5 +15,10 @@ class CreatePapers < ActiveRecord::Migration
t.timestamps
end
add_index(:papers, :reference)
add_index(:papers, :originator)
add_index(:papers, :body)
add_index(:papers, [:reference, :body], unique: true)
end
end

View file

@ -0,0 +1,8 @@
class CreateImporters < ActiveRecord::Migration
def change
create_table :importers do |t|
t.string :url
t.timestamps null: false
end
end
end