diff --git a/db/migrate/20241113155952_remove_null_strings_from_measurement_units.rb b/db/migrate/20241113155952_remove_null_strings_from_measurement_units.rb new file mode 100644 index 00000000..9b5e9195 --- /dev/null +++ b/db/migrate/20241113155952_remove_null_strings_from_measurement_units.rb @@ -0,0 +1,8 @@ +class RemoveNullStringsFromMeasurementUnits < ActiveRecord::Migration[6.1] + def up + execute "UPDATE measurements SET unit = NULL WHERE unit = 'NULL'" + execute "UPDATE sensors SET unit = NULL WHERE unit = 'NULL'" + end + + def down; end +end diff --git a/db/schema.rb b/db/schema.rb index cc624da1..435d9451 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2024_10_14_052837) do +ActiveRecord::Schema.define(version: 2024_11_13_155952) do # These are extensions that must be enabled in order to support this database enable_extension "adminpack"