mirror of
https://github.com/CodeforLeipzig/stadtratmonitor.git
synced 2025-06-07 00:51:37 +02:00
Add importer model, validations to paper model
This commit is contained in:
parent
568abb631f
commit
46de026234
8 changed files with 67 additions and 13 deletions
|
@ -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
|
||||
|
|
8
db/migrate/20150517152218_create_importers.rb
Normal file
8
db/migrate/20150517152218_create_importers.rb
Normal 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
|
18
db/schema.rb
18
db/schema.rb
|
@ -11,12 +11,19 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20150413193656) do
|
||||
ActiveRecord::Schema.define(version: 20150517152218) do
|
||||
|
||||
create_table "papers", force: true do |t|
|
||||
create_table "importers", force: :cascade do |t|
|
||||
t.string "url"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "papers", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.string "url"
|
||||
t.string "reference"
|
||||
t.string "body"
|
||||
t.datetime "published_at"
|
||||
t.datetime "scraped_at"
|
||||
t.string "paper_type"
|
||||
|
@ -27,7 +34,12 @@ ActiveRecord::Schema.define(version: 20150413193656) do
|
|||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
create_table "users", force: true do |t|
|
||||
add_index "papers", ["body"], name: "index_papers_on_body"
|
||||
add_index "papers", ["originator"], name: "index_papers_on_originator"
|
||||
add_index "papers", ["reference", "body"], name: "index_papers_on_reference_and_body", unique: true
|
||||
add_index "papers", ["reference"], name: "index_papers_on_reference"
|
||||
|
||||
create_table "users", force: :cascade do |t|
|
||||
t.string "email"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue