soundcloud / lhm

Online MySQL schema migrations
BSD 3-Clause "New" or "Revised" License
1.83k stars 190 forks source link

LHM is locking my table #79

Closed phacops closed 9 years ago

phacops commented 10 years ago

Simple table alteration:

Lhm.change_table :shopping_carts do |m|
  m.add_column :created_at, "datetime"
end

I run the script and go to my database to see if the original table is locked:

mysql> SHOW OPEN TABLES where `Table` = 'shopping_carts';
+----------------------+----------------+--------+-------------+
| Database             | Table          | In_use | Name_locked |
+----------------------+----------------+--------+-------------+
| inventory_production | shopping_carts |      1 |           0 |
+----------------------+----------------+--------+-------------+

The table is locked. Isn't LHM supposed to prevent this? I assume I missed something obvious but don't see what.

Gemfile:

source 'https://rubygems.org'

gem 'activerecord'
gem 'mysql2'
gem 'lhm'
phacops commented 9 years ago

Nothing was wrong with lhm, maybe my database was not strong enough to support default values. I used a throttler to change the behaviour and add some documentation for the next guy struggling with this.

https://github.com/soundcloud/lhm/pull/80