Adds migrations

This commit is contained in:
kikito
2016-05-20 12:40:52 +02:00
parent b375e696c0
commit 40ae4efe26
5 changed files with 135 additions and 1 deletions

View File

@@ -0,0 +1,15 @@
class CreateBudgets < ActiveRecord::Migration
def change
create_table :budgets do |t|
t.string "name", limit: 30
t.text "description"
t.string "currency_symbol", limit: 10
t.string "phase", default: "on_hold", limit: 15
t.boolean "valuating", default: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
end
end

View File

@@ -0,0 +1,38 @@
class CreateBudgetInvestments < ActiveRecord::Migration
def change
create_table :budget_investments do |t|
t.references "geozone"
t.integer "author_id", index: true
t.integer "administrator_id", index: true
t.string "title"
t.text "description"
t.string "external_url"
t.integer "price", limit: 8
t.string "feasibility", default: "undecided", limit: 15
t.text "price_explanation"
t.text "unfeasibility_explanation"
t.text "internal_comments"
t.boolean "valuation_finished", default: false
t.integer "valuation_assignments_count", default: 0
t.integer "price_first_year", limit: 8
t.string "duration"
t.datetime "hidden_at"
t.integer "cached_votes_up", default: 0
t.integer "comments_count", default: 0
t.integer "confidence_score", default: 0, null: false
t.integer "physical_votes", default: 0
t.tsvector "tsv"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
add_index :budget_investments, :tsv, using: "gin"
end
end

View File

@@ -0,0 +1,12 @@
class CreateBudgetBallots < ActiveRecord::Migration
def change
create_table :budget_ballots do |t|
t.references :geozone
t.references :user
t.references :budget
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
end
end

View File

@@ -0,0 +1,11 @@
class CreateBudgetBallotLines < ActiveRecord::Migration
def change
create_table :budget_ballot_lines do |t|
t.integer :ballot_id, index: true
t.integer :investment_id, index: true
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
end
end

View File

@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20160510161858) do
ActiveRecord::Schema.define(version: 20160520100347) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -63,6 +63,64 @@ ActiveRecord::Schema.define(version: 20160510161858) do
add_index "annotations", ["legislation_id"], name: "index_annotations_on_legislation_id", using: :btree
add_index "annotations", ["user_id"], name: "index_annotations_on_user_id", using: :btree
create_table "budget_ballot_lines", force: :cascade do |t|
t.integer "ballot_id"
t.integer "investment_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
add_index "budget_ballot_lines", ["ballot_id"], name: "index_budget_ballot_lines_on_ballot_id", using: :btree
add_index "budget_ballot_lines", ["investment_id"], name: "index_budget_ballot_lines_on_investment_id", using: :btree
create_table "budget_ballots", force: :cascade do |t|
t.integer "geozone_id"
t.integer "user_id"
t.integer "budget_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "budget_investments", force: :cascade do |t|
t.integer "geozone_id"
t.integer "author_id"
t.integer "administrator_id"
t.string "title"
t.text "description"
t.string "external_url"
t.integer "price", limit: 8
t.string "feasibility", limit: 15, default: "undecided"
t.text "price_explanation"
t.text "unfeasibility_explanation"
t.text "internal_comments"
t.boolean "valuation_finished", default: false
t.integer "valuation_assignments_count", default: 0
t.integer "price_first_year", limit: 8
t.string "duration"
t.datetime "hidden_at"
t.integer "cached_votes_up", default: 0
t.integer "comments_count", default: 0
t.integer "confidence_score", default: 0, null: false
t.integer "physical_votes", default: 0
t.tsvector "tsv"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
add_index "budget_investments", ["administrator_id"], name: "index_budget_investments_on_administrator_id", using: :btree
add_index "budget_investments", ["author_id"], name: "index_budget_investments_on_author_id", using: :btree
add_index "budget_investments", ["tsv"], name: "index_budget_investments_on_tsv", using: :gin
create_table "budgets", force: :cascade do |t|
t.string "name", limit: 30
t.text "description"
t.string "currency_symbol", limit: 10
t.string "phase", limit: 15, default: "on_hold"
t.boolean "valuating", default: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "campaigns", force: :cascade do |t|
t.string "name"
t.string "track_id"