diff --git a/db/migrate/20160518142529_create_budgets.rb b/db/migrate/20160518142529_create_budgets.rb new file mode 100644 index 000000000..943038472 --- /dev/null +++ b/db/migrate/20160518142529_create_budgets.rb @@ -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 diff --git a/db/migrate/20160518151245_create_budget_investments.rb b/db/migrate/20160518151245_create_budget_investments.rb new file mode 100644 index 000000000..bdc77c967 --- /dev/null +++ b/db/migrate/20160518151245_create_budget_investments.rb @@ -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 diff --git a/db/migrate/20160519144152_create_budget_ballots.rb b/db/migrate/20160519144152_create_budget_ballots.rb new file mode 100644 index 000000000..3131098b5 --- /dev/null +++ b/db/migrate/20160519144152_create_budget_ballots.rb @@ -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 diff --git a/db/migrate/20160520100347_create_budget_ballot_lines.rb b/db/migrate/20160520100347_create_budget_ballot_lines.rb new file mode 100644 index 000000000..07377234d --- /dev/null +++ b/db/migrate/20160520100347_create_budget_ballot_lines.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index 78a3ffd45..2b91945f3 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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"