26 lines
494 B
Ruby
26 lines
494 B
Ruby
# frozen_string_literal: true
|
|
|
|
class ChangeSensors < ActiveRecord::Migration[6.1]
|
|
def up
|
|
drop_table :sensors
|
|
|
|
create_table :sensors, id: :uuid do |t|
|
|
t.timestamps
|
|
t.uuid :arduino_id, index: true
|
|
t.datetime :timestamp
|
|
t.string :type, index: true
|
|
t.integer :value
|
|
t.string :unit
|
|
end
|
|
end
|
|
|
|
def down
|
|
drop_table :sensors
|
|
|
|
create_table :sensors do |t|
|
|
t.string :nombre, unique: true, index: true
|
|
t.timestamps
|
|
end
|
|
end
|
|
end
|