guardar uuid
This commit is contained in:
parent
f0c7a1c50c
commit
3ac7755ab6
2 changed files with 68 additions and 20 deletions
|
@ -4,7 +4,7 @@
|
|||
# lectura y sensado.
|
||||
class RemoveReadingToArduinoAssociation < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_belongs_to :sensors, :reading, index: true
|
||||
add_column :sensors, :reading_id, :uuid, index: true
|
||||
remove_belongs_to :arduinos, :reading, index: true
|
||||
end
|
||||
end
|
||||
|
|
86
db/schema.rb
generated
86
db/schema.rb
generated
|
@ -10,20 +10,46 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2021_12_06_224353) do
|
||||
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.uuid "transaction_id"
|
||||
t.integer "local_id"
|
||||
t.string "local_id"
|
||||
t.index ["raspberry_id"], name: "index_arduinos_on_raspberry_id"
|
||||
t.index ["transaction_id"], name: "index_arduinos_on_transaction_id"
|
||||
end
|
||||
|
||||
create_table "blazer_audits", force: :cascade do |t|
|
||||
|
@ -82,26 +108,23 @@ ActiveRecord::Schema.define(version: 2021_12_06_224353) do
|
|||
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 "public_key"
|
||||
t.string "serial_number"
|
||||
t.index ["serial_number"], name: "index_raspberries_on_serial_number", unique: true
|
||||
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.datetime "timestamp"
|
||||
t.string "type"
|
||||
t.integer "value"
|
||||
t.string "unit"
|
||||
t.index ["arduino_id"], name: "index_sensors_on_arduino_id"
|
||||
t.index ["type"], name: "index_sensors_on_type"
|
||||
end
|
||||
|
||||
create_table "transactions", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||
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"
|
||||
|
@ -112,7 +135,28 @@ ActiveRecord::Schema.define(version: 2021_12_06_224353) do
|
|||
t.string "sample"
|
||||
t.string "storage"
|
||||
t.string "signature"
|
||||
t.index ["raspberry_id"], name: "index_transactions_on_raspberry_id"
|
||||
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|
|
||||
|
@ -126,9 +170,13 @@ ActiveRecord::Schema.define(version: 2021_12_06_224353) do
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue