From f1f3ecc4f7f4fd4515ae06c63087174835f4ae85 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Mon, 8 May 2023 14:37:33 +1000 Subject: [PATCH] Fixup order of statements in db schema It looks like the resolution of a merge conflict introduced the wrong ordering of schema statements. Rails wants to sort tables alphabetically and running `./bin/rails db:migrate` on a fresh database altered the schema.rb file. This should be fixed here. Rails also omits the default setting of `precision: 6` since Rails 7. The vouchers feature was developed during the upgrade to Rails 7. --- db/schema.rb | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index 9d2fa9d33c..dbcb97b5a1 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1190,6 +1190,16 @@ ActiveRecord::Schema[7.0].define(version: 2023_04_24_141213) do t.index ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id" end + create_table "vouchers", force: :cascade do |t| + t.string "code", limit: 255, null: false + t.datetime "expiry_date" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.bigint "enterprise_id" + t.index ["code", "enterprise_id"], name: "index_vouchers_on_code_and_enterprise_id", unique: true + t.index ["enterprise_id"], name: "index_vouchers_on_enterprise_id" + end + create_table "webhook_endpoints", force: :cascade do |t| t.string "url", null: false t.datetime "created_at", null: false @@ -1198,16 +1208,6 @@ ActiveRecord::Schema[7.0].define(version: 2023_04_24_141213) do t.index ["user_id"], name: "index_webhook_endpoints_on_user_id" end - create_table "vouchers", force: :cascade do |t| - t.string "code", limit: 255, null: false - t.datetime "expiry_date" - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false - t.bigint "enterprise_id" - t.index ["code", "enterprise_id"], name: "index_vouchers_on_code_and_enterprise_id", unique: true - t.index ["enterprise_id"], name: "index_vouchers_on_enterprise_id" - 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" add_foreign_key "adjustment_metadata", "enterprises", name: "adjustment_metadata_enterprise_id_fk" @@ -1312,6 +1312,6 @@ ActiveRecord::Schema[7.0].define(version: 2023_04_24_141213) do add_foreign_key "subscriptions", "spree_shipping_methods", column: "shipping_method_id", name: "subscriptions_shipping_method_id_fk" add_foreign_key "variant_overrides", "enterprises", column: "hub_id", name: "variant_overrides_hub_id_fk" add_foreign_key "variant_overrides", "spree_variants", column: "variant_id", name: "variant_overrides_variant_id_fk" - add_foreign_key "webhook_endpoints", "spree_users", column: "user_id" add_foreign_key "vouchers", "enterprises" + add_foreign_key "webhook_endpoints", "spree_users", column: "user_id" end