Skip to content

Commit

Permalink
Merge pull request openfoodfoundation#13074 from rioug/sync-prod-data…
Browse files Browse the repository at this point in the history
…bse-schema

Sync prod database schema
  • Loading branch information
mkllnk authored Jan 14, 2025
2 parents 92c4508 + 600195a commit eace31f
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
27 changes: 27 additions & 0 deletions db/migrate/20241211060023_remove_variant_default_value.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
class RemoveVariantDefaultValue < ActiveRecord::Migration[7.0]
def up
change_table :spree_variants do |t|
t.change_null :weight, true
t.change_default :weight, nil
t.change_null :unit_value, true
t.change_default :unit_value, nil
end
execute <<-SQL
ALTER TABLE spree_variants
DROP CONSTRAINT IF EXISTS check_unit_value_for_nan;
ALTER TABLE spree_variants
DROP CONSTRAINT IF EXISTS check_weight_for_nan;
SQL
end

def down
change_table :spree_variants do |t|
t.change_null :weight, false
t.change_default :weight, "0.0"
t.change_null :unit_value, false
t.change_default :unit_value, "1.0"
t.check_constraint("unit_value <> 'NaN'::double precision", name: "check_unit_value_for_nan")
t.check_constraint("weight <> 'NaN'::numeric", name: "check_weight_for_nan")
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class CustomersCreatedManuallyRemoveNull < ActiveRecord::Migration[7.0]
def change
change_column_null :customers, :created_manually, true
end
end
2 changes: 1 addition & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.0].define(version: 2024_11_13_185651) do
ActiveRecord::Schema[7.0].define(version: 2025_01_13_055412) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_stat_statements"
enable_extension "plpgsql"
Expand Down

0 comments on commit eace31f

Please sign in to comment.