182 lines
7.2 KiB
Ruby
Generated
182 lines
7.2 KiB
Ruby
Generated
# 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.
|
|
#
|
|
# This file is the source Rails uses to define your schema when running `bin/rails
|
|
# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
|
|
# be faster and is potentially less error prone than running all of your
|
|
# migrations from scratch. Old migrations may fail to apply correctly if those
|
|
# migrations use external dependencies or application code.
|
|
#
|
|
# It's strongly recommended that you check this file into your version control system.
|
|
|
|
ActiveRecord::Schema.define(version: 2022_06_11_174308) do
|
|
|
|
# These are extensions that must be enabled in order to support this database
|
|
enable_extension "pgcrypto"
|
|
enable_extension "plpgsql"
|
|
|
|
create_table "active_storage_attachments", force: :cascade do |t|
|
|
t.string "name", null: false
|
|
t.string "record_type", null: false
|
|
t.bigint "record_id", null: false
|
|
t.bigint "blob_id", null: false
|
|
t.datetime "created_at", null: false
|
|
t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id"
|
|
t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true
|
|
end
|
|
|
|
create_table "active_storage_blobs", force: :cascade do |t|
|
|
t.string "key", null: false
|
|
t.string "filename", null: false
|
|
t.string "content_type"
|
|
t.text "metadata"
|
|
t.string "service_name", null: false
|
|
t.bigint "byte_size", null: false
|
|
t.string "checksum", null: false
|
|
t.datetime "created_at", null: false
|
|
t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
|
|
end
|
|
|
|
create_table "active_storage_variant_records", force: :cascade do |t|
|
|
t.bigint "blob_id", null: false
|
|
t.string "variation_digest", null: false
|
|
t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true
|
|
end
|
|
|
|
create_table "arduinos", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
|
t.datetime "created_at", precision: 6, null: false
|
|
t.datetime "updated_at", precision: 6, null: false
|
|
t.uuid "raspberry_id"
|
|
t.string "local_id"
|
|
t.index ["raspberry_id"], name: "index_arduinos_on_raspberry_id"
|
|
end
|
|
|
|
create_table "blazer_audits", force: :cascade do |t|
|
|
t.bigint "user_id"
|
|
t.bigint "query_id"
|
|
t.text "statement"
|
|
t.string "data_source"
|
|
t.datetime "created_at"
|
|
t.index ["query_id"], name: "index_blazer_audits_on_query_id"
|
|
t.index ["user_id"], name: "index_blazer_audits_on_user_id"
|
|
end
|
|
|
|
create_table "blazer_checks", force: :cascade do |t|
|
|
t.bigint "creator_id"
|
|
t.bigint "query_id"
|
|
t.string "state"
|
|
t.string "schedule"
|
|
t.text "emails"
|
|
t.text "slack_channels"
|
|
t.string "check_type"
|
|
t.text "message"
|
|
t.datetime "last_run_at"
|
|
t.datetime "created_at", precision: 6, null: false
|
|
t.datetime "updated_at", precision: 6, null: false
|
|
t.index ["creator_id"], name: "index_blazer_checks_on_creator_id"
|
|
t.index ["query_id"], name: "index_blazer_checks_on_query_id"
|
|
end
|
|
|
|
create_table "blazer_dashboard_queries", force: :cascade do |t|
|
|
t.bigint "dashboard_id"
|
|
t.bigint "query_id"
|
|
t.integer "position"
|
|
t.datetime "created_at", precision: 6, null: false
|
|
t.datetime "updated_at", precision: 6, null: false
|
|
t.index ["dashboard_id"], name: "index_blazer_dashboard_queries_on_dashboard_id"
|
|
t.index ["query_id"], name: "index_blazer_dashboard_queries_on_query_id"
|
|
end
|
|
|
|
create_table "blazer_dashboards", force: :cascade do |t|
|
|
t.bigint "creator_id"
|
|
t.string "name"
|
|
t.datetime "created_at", precision: 6, null: false
|
|
t.datetime "updated_at", precision: 6, null: false
|
|
t.index ["creator_id"], name: "index_blazer_dashboards_on_creator_id"
|
|
end
|
|
|
|
create_table "blazer_queries", force: :cascade do |t|
|
|
t.bigint "creator_id"
|
|
t.string "name"
|
|
t.text "description"
|
|
t.text "statement"
|
|
t.string "data_source"
|
|
t.string "status"
|
|
t.datetime "created_at", precision: 6, null: false
|
|
t.datetime "updated_at", precision: 6, null: false
|
|
t.index ["creator_id"], name: "index_blazer_queries_on_creator_id"
|
|
end
|
|
|
|
create_table "public_keys", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
|
t.datetime "created_at", precision: 6, null: false
|
|
t.datetime "updated_at", precision: 6, null: false
|
|
t.uuid "raspberry_id"
|
|
t.string "content", null: false
|
|
t.index ["raspberry_id"], name: "index_public_keys_on_raspberry_id"
|
|
end
|
|
|
|
create_table "raspberries", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
|
t.datetime "created_at", precision: 6, null: false
|
|
t.datetime "updated_at", precision: 6, null: false
|
|
t.string "name"
|
|
t.string "serial_number"
|
|
t.index ["serial_number"], name: "index_raspberries_on_serial_number", unique: true
|
|
end
|
|
|
|
create_table "readings", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
|
t.datetime "created_at", precision: 6, null: false
|
|
t.datetime "updated_at", precision: 6, null: false
|
|
t.uuid "raspberry_id"
|
|
t.datetime "timestamp"
|
|
t.string "error_code"
|
|
t.jsonb "coordinates"
|
|
t.string "battery_status"
|
|
t.string "sample"
|
|
t.string "storage"
|
|
t.string "signature"
|
|
t.text "raw_transaction"
|
|
t.boolean "verified", default: false
|
|
t.index ["raspberry_id"], name: "index_readings_on_raspberry_id"
|
|
end
|
|
|
|
create_table "sensors", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
|
t.datetime "created_at", precision: 6, null: false
|
|
t.datetime "updated_at", precision: 6, null: false
|
|
t.uuid "arduino_id"
|
|
t.string "local_type"
|
|
t.decimal "value", precision: 10
|
|
t.string "unit"
|
|
t.integer "error"
|
|
t.uuid "reading_id"
|
|
t.index ["arduino_id"], name: "index_sensors_on_arduino_id"
|
|
t.index ["local_type"], name: "index_sensors_on_local_type"
|
|
end
|
|
|
|
create_table "sites", force: :cascade do |t|
|
|
t.datetime "created_at", precision: 6, null: false
|
|
t.datetime "updated_at", precision: 6, null: false
|
|
t.string "title", null: false
|
|
end
|
|
|
|
create_table "users", force: :cascade do |t|
|
|
t.string "email", default: "", null: false
|
|
t.string "encrypted_password", default: "", null: false
|
|
t.string "reset_password_token"
|
|
t.datetime "reset_password_sent_at"
|
|
t.datetime "remember_created_at"
|
|
t.integer "failed_attempts", default: 0, null: false
|
|
t.string "unlock_token"
|
|
t.datetime "locked_at"
|
|
t.datetime "created_at", precision: 6, null: false
|
|
t.datetime "updated_at", precision: 6, null: false
|
|
t.bigint "created_by_id"
|
|
t.index ["created_by_id"], name: "index_users_on_created_by_id"
|
|
t.index ["email"], name: "index_users_on_email", unique: true
|
|
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
|
|
t.index ["unlock_token"], name: "index_users_on_unlock_token", unique: true
|
|
end
|
|
|
|
add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
|
|
add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
|
|
end
|