class CreateInventoryReservations < ActiveRecord::Migration[7.1]
def change
create_table :inventory_items do |t|
t.string :sku, null: false
t.integer :quantity_on_hand, null: false, default: 0
t.integer :quantity_reserved, null: false, default: 0
import errno
import fcntl
import os
import time
-- Step 1: add the column nullable, no default.
-- Catalog-only change in Postgres 11+, returns instantly.
ALTER TABLE orders
ADD COLUMN currency text;
-- Optional: keep the lock attempt bounded so a long-running