# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20150705035419) do

  # These are extensions that must be enabled in order to support this database
  enable_extension "plpgsql"
  enable_extension "postgis"

  create_table "data_entities", force: :cascade do |t|
    t.integer  "data_set_id",                                               null: false
    t.geometry "area",        limit: {:srid=>4326, :type=>"multi_polygon"}
    t.jsonb    "data"
    t.datetime "created_at",                                                null: false
    t.datetime "updated_at",                                                null: false
  end

  add_index "data_entities", ["area"], name: "index_data_entities_on_area", using: :gist
  add_index "data_entities", ["data"], name: "data_index", using: :gin
  add_index "data_entities", ["data_set_id"], name: "index_data_entities_on_data_set_id", using: :btree

  create_table "data_sets", force: :cascade do |t|
    t.string   "name"
    t.geometry "bounds",         limit: {:srid=>4326, :type=>"multi_line_string"}
    t.string   "concrete_class",                                                   default: "StraightOutput"
    t.jsonb    "data"
    t.datetime "created_at",                                                                                  null: false
    t.datetime "updated_at",                                                                                  null: false
    t.geometry "area",           limit: {:srid=>4326, :type=>"multi_polygon"}
    t.string   "url"
  end

  add_index "data_sets", ["bounds"], name: "index_data_sets_on_bounds", using: :gist

  create_table "electorates", force: :cascade do |t|
    t.string   "name"
    t.geometry "area",       limit: {:srid=>4326, :type=>"multi_polygon"}
    t.datetime "created_at",                                               null: false
    t.datetime "updated_at",                                               null: false
    t.string   "url"
    t.json     "data"
  end

  add_index "electorates", ["area"], name: "index_electorates_on_area", using: :gist

  create_table "postcodes", force: :cascade do |t|
    t.string   "name"
    t.geometry "area",     limit: {:srid=>4326, :type=>"multi_polygon"}
    t.string   "postcode"
    t.integer  "state_id"
    t.string   "url"
  end

  add_index "postcodes", ["area"], name: "index_postcodes_on_area", using: :gist

  create_table "states", force: :cascade do |t|
    t.string "name"
  end

end
