Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make db timestamps nullable #5663

Merged
merged 2 commits into from
Jun 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
251 changes: 251 additions & 0 deletions db/migrate/20200624091611_make_timestamps_nullable.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,251 @@
class MakeTimestampsNullable < ActiveRecord::Migration
def up
change_column_null :customers, :created_at, true
change_column_null :customers, :updated_at, true
change_column_null :delayed_jobs, :created_at, true
change_column_null :delayed_jobs, :updated_at, true
change_column_null :distributors_shipping_methods, :created_at, true
change_column_null :distributors_shipping_methods, :updated_at, true
change_column_null :enterprise_fees, :created_at, true
change_column_null :enterprise_fees, :updated_at, true
change_column_null :enterprises, :created_at, true
change_column_null :enterprises, :updated_at, true
change_column_null :exchange_fees, :created_at, true
change_column_null :exchange_fees, :updated_at, true
change_column_null :exchange_variants, :created_at, true
change_column_null :exchange_variants, :updated_at, true
change_column_null :exchanges, :created_at, true
change_column_null :exchanges, :updated_at, true
change_column_null :inventory_items, :created_at, true
change_column_null :inventory_items, :updated_at, true
change_column_null :order_cycle_schedules, :created_at, true
change_column_null :order_cycle_schedules, :updated_at, true
change_column_null :order_cycles, :created_at, true
change_column_null :order_cycles, :updated_at, true
change_column_null :producer_properties, :created_at, true
change_column_null :producer_properties, :updated_at, true
change_column_null :proxy_orders, :created_at, true
change_column_null :proxy_orders, :updated_at, true
change_column_null :schedules, :created_at, true
change_column_null :schedules, :updated_at, true
change_column_null :sessions, :created_at, true
change_column_null :sessions, :updated_at, true
change_column_null :spree_activators, :created_at, true
change_column_null :spree_activators, :updated_at, true
change_column_null :spree_addresses, :created_at, true
change_column_null :spree_addresses, :updated_at, true
change_column_null :spree_adjustments, :created_at, true
change_column_null :spree_adjustments, :updated_at, true
change_column_null :spree_calculators, :created_at, true
change_column_null :spree_calculators, :updated_at, true
change_column_null :spree_configurations, :created_at, true
change_column_null :spree_configurations, :updated_at, true
change_column_null :spree_credit_cards, :created_at, true
change_column_null :spree_credit_cards, :updated_at, true
change_column_null :spree_gateways, :created_at, true
change_column_null :spree_gateways, :updated_at, true
change_column_null :spree_inventory_units, :created_at, true
change_column_null :spree_inventory_units, :updated_at, true
change_column_null :spree_line_items, :created_at, true
change_column_null :spree_line_items, :updated_at, true
change_column_null :spree_log_entries, :created_at, true
change_column_null :spree_log_entries, :updated_at, true
change_column_null :spree_option_types, :created_at, true
change_column_null :spree_option_types, :updated_at, true
change_column_null :spree_option_values, :created_at, true
change_column_null :spree_option_values, :updated_at, true
change_column_null :spree_orders, :created_at, true
change_column_null :spree_orders, :updated_at, true
change_column_null :spree_payment_methods, :created_at, true
change_column_null :spree_payment_methods, :updated_at, true
change_column_null :spree_payments, :created_at, true
change_column_null :spree_payments, :updated_at, true
change_column_null :spree_preferences, :created_at, true
change_column_null :spree_preferences, :updated_at, true
change_column_null :spree_product_option_types, :created_at, true
change_column_null :spree_product_option_types, :updated_at, true
change_column_null :spree_product_properties, :created_at, true
change_column_null :spree_product_properties, :updated_at, true
change_column_null :spree_products, :created_at, true
change_column_null :spree_products, :updated_at, true
change_column_null :spree_promotion_rules, :created_at, true
change_column_null :spree_promotion_rules, :updated_at, true
change_column_null :spree_properties, :created_at, true
change_column_null :spree_properties, :updated_at, true
change_column_null :spree_return_authorizations, :created_at, true
change_column_null :spree_return_authorizations, :updated_at, true
change_column_null :spree_shipments, :created_at, true
change_column_null :spree_shipments, :updated_at, true
change_column_null :spree_shipping_categories, :created_at, true
change_column_null :spree_shipping_categories, :updated_at, true
change_column_null :spree_shipping_method_categories, :created_at, true
change_column_null :spree_shipping_method_categories, :updated_at, true
change_column_null :spree_shipping_methods, :created_at, true
change_column_null :spree_shipping_methods, :updated_at, true
change_column_null :spree_shipping_rates, :created_at, true
change_column_null :spree_shipping_rates, :updated_at, true
change_column_null :spree_skrill_transactions, :created_at, true
change_column_null :spree_skrill_transactions, :updated_at, true
change_column_null :spree_state_changes, :created_at, true
change_column_null :spree_state_changes, :updated_at, true
change_column_null :spree_stock_items, :created_at, true
change_column_null :spree_stock_items, :updated_at, true
change_column_null :spree_stock_locations, :created_at, true
change_column_null :spree_stock_locations, :updated_at, true
change_column_null :spree_stock_movements, :created_at, true
change_column_null :spree_stock_movements, :updated_at, true
change_column_null :spree_stock_transfers, :created_at, true
change_column_null :spree_stock_transfers, :updated_at, true
change_column_null :spree_tax_categories, :created_at, true
change_column_null :spree_tax_categories, :updated_at, true
change_column_null :spree_tax_rates, :created_at, true
change_column_null :spree_tax_rates, :updated_at, true
change_column_null :spree_taxonomies, :created_at, true
change_column_null :spree_taxonomies, :updated_at, true
change_column_null :spree_taxons, :created_at, true
change_column_null :spree_taxons, :updated_at, true
change_column_null :spree_tokenized_permissions, :created_at, true
change_column_null :spree_tokenized_permissions, :updated_at, true
change_column_null :spree_users, :created_at, true
change_column_null :spree_users, :updated_at, true
change_column_null :spree_zone_members, :created_at, true
change_column_null :spree_zone_members, :updated_at, true
change_column_null :spree_zones, :created_at, true
change_column_null :spree_zones, :updated_at, true
change_column_null :stripe_accounts, :created_at, true
change_column_null :stripe_accounts, :updated_at, true
change_column_null :subscription_line_items, :created_at, true
change_column_null :subscription_line_items, :updated_at, true
change_column_null :subscriptions, :created_at, true
change_column_null :subscriptions, :updated_at, true
change_column_null :tag_rules, :created_at, true
change_column_null :tag_rules, :updated_at, true
change_column_null :column_preferences, :created_at, true
change_column_null :column_preferences, :updated_at, true
end

def down
change_column_null :customers, :created_at, false
change_column_null :customers, :updated_at, false
change_column_null :delayed_jobs, :created_at, false
change_column_null :delayed_jobs, :updated_at, false
change_column_null :distributors_shipping_methods, :created_at, false
change_column_null :distributors_shipping_methods, :updated_at, false
change_column_null :enterprise_fees, :created_at, false
change_column_null :enterprise_fees, :updated_at, false
change_column_null :enterprises, :created_at, false
change_column_null :enterprises, :updated_at, false
change_column_null :exchange_fees, :created_at, false
change_column_null :exchange_fees, :updated_at, false
change_column_null :exchange_variants, :created_at, false
change_column_null :exchange_variants, :updated_at, false
change_column_null :exchanges, :created_at, false
change_column_null :exchanges, :updated_at, false
change_column_null :inventory_items, :created_at, false
change_column_null :inventory_items, :updated_at, false
change_column_null :order_cycle_schedules, :created_at, false
change_column_null :order_cycle_schedules, :updated_at, false
change_column_null :order_cycles, :created_at, false
change_column_null :order_cycles, :updated_at, false
change_column_null :producer_properties, :created_at, false
change_column_null :producer_properties, :updated_at, false
change_column_null :proxy_orders, :created_at, false
change_column_null :proxy_orders, :updated_at, false
change_column_null :schedules, :created_at, false
change_column_null :schedules, :updated_at, false
change_column_null :sessions, :created_at, false
change_column_null :sessions, :updated_at, false
change_column_null :spree_activators, :created_at, false
change_column_null :spree_activators, :updated_at, false
change_column_null :spree_addresses, :created_at, false
change_column_null :spree_addresses, :updated_at, false
change_column_null :spree_adjustments, :created_at, false
change_column_null :spree_adjustments, :updated_at, false
change_column_null :spree_calculators, :created_at, false
change_column_null :spree_calculators, :updated_at, false
change_column_null :spree_configurations, :created_at, false
change_column_null :spree_configurations, :updated_at, false
change_column_null :spree_credit_cards, :created_at, false
change_column_null :spree_credit_cards, :updated_at, false
change_column_null :spree_gateways, :created_at, false
change_column_null :spree_gateways, :updated_at, false
change_column_null :spree_inventory_units, :created_at, false
change_column_null :spree_inventory_units, :updated_at, false
change_column_null :spree_line_items, :created_at, false
change_column_null :spree_line_items, :updated_at, false
change_column_null :spree_log_entries, :created_at, false
change_column_null :spree_log_entries, :updated_at, false
change_column_null :spree_option_types, :created_at, false
change_column_null :spree_option_types, :updated_at, false
change_column_null :spree_option_values, :created_at, false
change_column_null :spree_option_values, :updated_at, false
change_column_null :spree_orders, :created_at, false
change_column_null :spree_orders, :updated_at, false
change_column_null :spree_payment_methods, :created_at, false
change_column_null :spree_payment_methods, :updated_at, false
change_column_null :spree_payments, :created_at, false
change_column_null :spree_payments, :updated_at, false
change_column_null :spree_preferences, :created_at, false
change_column_null :spree_preferences, :updated_at, false
change_column_null :spree_product_option_types, :created_at, false
change_column_null :spree_product_option_types, :updated_at, false
change_column_null :spree_product_properties, :created_at, false
change_column_null :spree_product_properties, :updated_at, false
change_column_null :spree_products, :created_at, false
change_column_null :spree_products, :updated_at, false
change_column_null :spree_promotion_rules, :created_at, false
change_column_null :spree_promotion_rules, :updated_at, false
change_column_null :spree_properties, :created_at, false
change_column_null :spree_properties, :updated_at, false
change_column_null :spree_return_authorizations, :created_at, false
change_column_null :spree_return_authorizations, :updated_at, false
change_column_null :spree_shipments, :created_at, false
change_column_null :spree_shipments, :updated_at, false
change_column_null :spree_shipping_categories, :created_at, false
change_column_null :spree_shipping_categories, :updated_at, false
change_column_null :spree_shipping_method_categories, :created_at, false
change_column_null :spree_shipping_method_categories, :updated_at, false
change_column_null :spree_shipping_methods, :created_at, false
change_column_null :spree_shipping_methods, :updated_at, false
change_column_null :spree_shipping_rates, :created_at, false
change_column_null :spree_shipping_rates, :updated_at, false
change_column_null :spree_skrill_transactions, :created_at, false
change_column_null :spree_skrill_transactions, :updated_at, false
change_column_null :spree_state_changes, :created_at, false
change_column_null :spree_state_changes, :updated_at, false
change_column_null :spree_stock_items, :created_at, false
change_column_null :spree_stock_items, :updated_at, false
change_column_null :spree_stock_locations, :created_at, false
change_column_null :spree_stock_locations, :updated_at, false
change_column_null :spree_stock_movements, :created_at, false
change_column_null :spree_stock_movements, :updated_at, false
change_column_null :spree_stock_transfers, :created_at, false
change_column_null :spree_stock_transfers, :updated_at, false
change_column_null :spree_tax_categories, :created_at, false
change_column_null :spree_tax_categories, :updated_at, false
change_column_null :spree_tax_rates, :created_at, false
change_column_null :spree_tax_rates, :updated_at, false
change_column_null :spree_taxonomies, :created_at, false
change_column_null :spree_taxonomies, :updated_at, false
change_column_null :spree_taxons, :created_at, false
change_column_null :spree_taxons, :updated_at, false
change_column_null :spree_tokenized_permissions, :created_at, false
change_column_null :spree_tokenized_permissions, :updated_at, false
change_column_null :spree_users, :created_at, false
change_column_null :spree_users, :updated_at, false
change_column_null :spree_zone_members, :created_at, false
change_column_null :spree_zone_members, :updated_at, false
change_column_null :spree_zones, :created_at, false
change_column_null :spree_zones, :updated_at, false
change_column_null :stripe_accounts, :created_at, false
change_column_null :stripe_accounts, :updated_at, false
change_column_null :subscription_line_items, :created_at, false
change_column_null :subscription_line_items, :updated_at, false
change_column_null :subscriptions, :created_at, false
change_column_null :subscriptions, :updated_at, false
change_column_null :tag_rules, :created_at, false
change_column_null :tag_rules, :updated_at, false
change_column_null :column_preferences, :created_at, false
change_column_null :column_preferences, :updated_at, false
end
end
22 changes: 11 additions & 11 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20200623140437) do
ActiveRecord::Schema.define(version: 20200624091611) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -273,8 +273,8 @@
add_index "inventory_items", ["enterprise_id", "variant_id"], name: "index_inventory_items_on_enterprise_id_and_variant_id", unique: true, using: :btree

create_table "order_cycle_schedules", force: true do |t|
t.integer "order_cycle_id", null: false
t.integer "schedule_id", null: false
t.integer "order_cycle_id", null: false
t.integer "schedule_id", null: false
t.datetime "created_at"
t.datetime "updated_at"
end
Expand Down Expand Up @@ -570,8 +570,8 @@

add_index "spree_orders", ["completed_at", "user_id", "created_by_id", "created_at"], name: "spree_orders_completed_at_user_id_created_by_id_created_at_idx", using: :btree
add_index "spree_orders", ["customer_id"], name: "index_spree_orders_on_customer_id", using: :btree
add_index "spree_orders", ["number"], name: "index_orders_on_number", using: :btree
add_index "spree_orders", ["distributor_id"], name: "index_spree_orders_on_distributor_id", using: :btree
add_index "spree_orders", ["number"], name: "index_orders_on_number", using: :btree
add_index "spree_orders", ["order_cycle_id"], name: "index_spree_orders_on_order_cycle_id", using: :btree
add_index "spree_orders", ["user_id"], name: "index_spree_orders_on_user_id", using: :btree

Expand Down Expand Up @@ -644,9 +644,9 @@
add_index "spree_preferences", ["key"], name: "index_spree_preferences_on_key", unique: true, using: :btree

create_table "spree_prices", force: true do |t|
t.integer "variant_id", null: false
t.decimal "amount", precision: 8, scale: 2
t.string "currency"
t.integer "variant_id", null: false
t.decimal "amount", precision: 8, scale: 2
t.string "currency"
t.datetime "deleted_at"
end

Expand Down Expand Up @@ -723,7 +723,7 @@
add_index "spree_products", ["permalink"], name: "index_products_on_permalink", using: :btree
add_index "spree_products", ["permalink"], name: "permalink_idx_unique", unique: true, using: :btree
add_index "spree_products", ["primary_taxon_id"], name: "index_spree_products_on_primary_taxon_id", using: :btree
add_index "spree_products", ["supplier_id"], name: "index_spree_products_on_supplier_id"
add_index "spree_products", ["supplier_id"], name: "index_spree_products_on_supplier_id", using: :btree

create_table "spree_products_promotion_rules", id: false, force: true do |t|
t.integer "product_id"
Expand Down Expand Up @@ -1189,9 +1189,9 @@
add_index "variant_overrides", ["variant_id", "hub_id"], name: "index_variant_overrides_on_variant_id_and_hub_id", using: :btree

create_table "versions", force: true do |t|
t.string "item_type", null: false
t.integer "item_id", null: false
t.string "event", null: false
t.string "item_type", null: false
t.integer "item_id", null: false
t.string "event", null: false
t.string "whodunnit"
t.text "object"
t.datetime "created_at"
Expand Down