diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2015-12-15 05:26:14 +0900 |
---|---|---|
committer | Jeremy Daer <jeremydaer@gmail.com> | 2017-02-01 22:13:46 -0700 |
commit | 65bf1c60053e727835e06392d27a2fb49665484c (patch) | |
tree | 02a5a5b0cead003b2d24c2419585748830b4416e /railties/lib/rails/commands/application/application_command.rb | |
parent | c98e08df7a303f4c7d6d37aa638d4ce97bb1ec9c (diff) | |
download | rails-65bf1c60053e727835e06392d27a2fb49665484c.tar.gz rails-65bf1c60053e727835e06392d27a2fb49665484c.tar.bz2 rails-65bf1c60053e727835e06392d27a2fb49665484c.zip |
Virtual/generated column support for MySQL 5.7.5+ and MariaDB 5.2.0+
MySQL generated columns: https://dev.mysql.com/doc/refman/5.7/en/create-table-generated-columns.html
MariaDB virtual columns: https://mariadb.com/kb/en/mariadb/virtual-computed-columns/
Declare virtual columns with `t.virtual name, type: …, as: "expression"`.
Pass `stored: true` to persist the generated value (false by default).
Example:
create_table :generated_columns do |t|
t.string :name
t.virtual :upper_name, type: :string, as: "UPPER(name)"
t.virtual :name_length, type: :integer, as: "LENGTH(name)", stored: true
t.index :name_length # May be indexed, too!
end
Closes #22589
Diffstat (limited to 'railties/lib/rails/commands/application/application_command.rb')
0 files changed, 0 insertions, 0 deletions