LoginSignup
0
0

More than 5 years have passed since last update.

ridgepoleで特定のテーブルを無視する

Posted at

背景

お仕事で担当してるシステムにて、DBがもはやmigrateが通らず詰んだオワタ状態だったのでridgepoleに移行してとても幸せな日々を送っております :raising_hand:

今回「特定のテーブルは無視したい」ケースが出てきたのでそのオプションをメモがてら。 :pencil:

特定のテーブルを無視するオプション

--ignore-tablesオプションを使って特定のテーブルを無視できます。

正規表現を使えるので、たとえばwp_から始まるテーブルを無視したい場合は、--ignore-tables ^wp_とすればOK。

オプションは複数指定できます。
--ignore-tables ^wp_,^hoge,fuga_items

以上です。 :raising_hand:

ついでによく使うコマンドのおさらい

schemaからDBに流し込む

$ bundle exec ridgepole --config config/database.yml -E development --apply

dry-run

$ bundle exec ridgepole --config config/database.yml -E development --apply --dry-run

DBからschemaを作る

--splitでテーブルごとにファイルを分割できます。

$ bundle exec ridgepole --config config/database.yml -E development --export --output db/schemas/Schemafile --split

wp_からはじまるテーブルは無視してexport

$ bundle exec ridgepole --config config/database.yml -E development --export --output db/schemas/Schemafile --split --ignore-tables ^wp_

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0