Skip to content

Comments

Support hash table options with --table-hash-options#331

Merged
winebarrel merged 1 commit intoridgepole:0.9from
alpaca-tc:hash_default_parameters
Jan 2, 2021
Merged

Support hash table options with --table-hash-options#331
winebarrel merged 1 commit intoridgepole:0.9from
alpaca-tc:hash_default_parameters

Conversation

@alpaca-tc
Copy link
Contributor

@alpaca-tc alpaca-tc commented Jan 1, 2021

related: #323 (comment)

Added option --table-hash-options to set default hash table options.

ridgepole --table-hash-options='{ "id": { "unsigned": true }, "charset": "utf8mb4" }'

@alpaca-tc alpaca-tc force-pushed the hash_default_parameters branch 2 times, most recently from 2af2e75 to ca29737 Compare January 1, 2021 14:00
@alpaca-tc alpaca-tc changed the base branch from 0.8 to 0.9 January 1, 2021 14:01
@alpaca-tc alpaca-tc changed the title Support hash table options with --table-hash-options [WIP] Support hash table options with --table-hash-options Jan 1, 2021
@alpaca-tc alpaca-tc force-pushed the hash_default_parameters branch from ca29737 to 1f8eb0f Compare January 1, 2021 16:50
@alpaca-tc alpaca-tc changed the title [WIP] Support hash table options with --table-hash-options Support hash table options with --table-hash-options Jan 1, 2021
@alpaca-tc alpaca-tc mentioned this pull request Jan 1, 2021
@alpaca-tc alpaca-tc force-pushed the hash_default_parameters branch 2 times, most recently from 3530e8a to abe7159 Compare January 1, 2021 17:02
bin/ridgepole Outdated
opt.on('', '--dry-run') { options[:dry_run] = true }
opt.on('', '--table-options OPTIONS') { |v| options[:table_options] = v }
opt.on('', '--table-hash-options JSON') do |v|
json = JSON.parse(v, symbolize_names: true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about using YAML?

  • Compatible with JSON
  • Same as the existing option (e.g. --config '{adapter: mysql2...}')
  • Can be written simply

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed 👍

related: ridgepole#323 (comment)

Added option `--table-hash-options` to set default hash table options.

```
ridgepole --table-hash-options='{ id: { unsigned: true }, charset: "utf8mb4" }'
```
@alpaca-tc alpaca-tc force-pushed the hash_default_parameters branch from abe7159 to 76793e0 Compare January 2, 2021 11:16
Comment on lines +90 to +91
# NOTE: Ruby2.4 doesn't support `symbolize_names: true`
hash = YAML.safe_load(v).deep_symbolize_keys
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Member

@winebarrel winebarrel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@winebarrel winebarrel merged commit 886afc3 into ridgepole:0.9 Jan 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants