Add communities and topics

This commit is contained in:
taitus
2017-08-07 12:51:49 +02:00
parent ee3b3f2c85
commit 43c17c3fc7
20 changed files with 210 additions and 10 deletions

View File

@@ -0,0 +1,7 @@
class CreateCommunity < ActiveRecord::Migration
def change
create_table :communities do |t|
t.timestamps null: false
end
end
end

View File

@@ -0,0 +1,5 @@
class AddCommunityToProposal < ActiveRecord::Migration
def change
add_reference :proposals, :community, index: true, foreign_key: true
end
end

View File

@@ -0,0 +1,9 @@
class CreateTopics < ActiveRecord::Migration
def change
create_table :topics do |t|
t.string :title, null: false
t.integer :author_id
t.references :community, index: true
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: 20170720092638) do
ActiveRecord::Schema.define(version: 20170807082243) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -236,6 +236,11 @@ ActiveRecord::Schema.define(version: 20170720092638) do
add_index "comments", ["hidden_at"], name: "index_comments_on_hidden_at", using: :btree
add_index "comments", ["user_id"], name: "index_comments_on_user_id", using: :btree
create_table "communities", force: :cascade do |t|
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "debates", force: :cascade do |t|
t.string "title", limit: 80
t.text "description"
@@ -749,11 +754,13 @@ ActiveRecord::Schema.define(version: 20170720092638) do
t.datetime "retired_at"
t.string "retired_reason"
t.text "retired_explanation"
t.integer "community_id"
end
add_index "proposals", ["author_id", "hidden_at"], name: "index_proposals_on_author_id_and_hidden_at", using: :btree
add_index "proposals", ["author_id"], name: "index_proposals_on_author_id", using: :btree
add_index "proposals", ["cached_votes_up"], name: "index_proposals_on_cached_votes_up", using: :btree
add_index "proposals", ["community_id"], name: "index_proposals_on_community_id", using: :btree
add_index "proposals", ["confidence_score"], name: "index_proposals_on_confidence_score", using: :btree
add_index "proposals", ["geozone_id"], name: "index_proposals_on_geozone_id", using: :btree
add_index "proposals", ["hidden_at"], name: "index_proposals_on_hidden_at", using: :btree
@@ -883,6 +890,14 @@ ActiveRecord::Schema.define(version: 20170720092638) do
add_index "tags", ["proposals_count"], name: "index_tags_on_proposals_count", using: :btree
add_index "tags", ["spending_proposals_count"], name: "index_tags_on_spending_proposals_count", using: :btree
create_table "topics", force: :cascade do |t|
t.string "title", null: false
t.integer "author_id"
t.integer "community_id"
end
add_index "topics", ["community_id"], name: "index_topics_on_community_id", using: :btree
create_table "users", force: :cascade do |t|
t.string "email", default: ""
t.string "encrypted_password", default: "", null: false
@@ -936,7 +951,7 @@ ActiveRecord::Schema.define(version: 20170720092638) do
t.boolean "email_digest", default: true
t.boolean "email_on_direct_message", default: true
t.boolean "official_position_badge", default: false
t.datetime "password_changed_at", default: '2017-06-22 11:21:30', null: false
t.datetime "password_changed_at", default: '2017-08-07 08:24:24', null: false
t.boolean "created_from_signature", default: false
t.integer "failed_email_digests_count", default: 0
t.text "former_users_data_log", default: ""
@@ -1062,6 +1077,7 @@ ActiveRecord::Schema.define(version: 20170720092638) do
add_foreign_key "poll_voters", "polls"
add_foreign_key "poll_white_results", "poll_booth_assignments", column: "booth_assignment_id"
add_foreign_key "poll_white_results", "poll_officer_assignments", column: "officer_assignment_id"
add_foreign_key "proposals", "communities"
add_foreign_key "users", "geozones"
add_foreign_key "valuators", "users"
end