rails
rails copied to clipboard
add linestring and multilinestring for mysql
Motivation / Background
In mysql, there are two column data types: linestring and multilinestring. At the moment, we cannot create those two using
t.column :test_col, :linestring
t.column :test_mcol, :multilinestring
When run db:migrate
, it will print to schema.rb
# Could not dump table "tests" because of following StandardError
# Unknown type 'linestring' for column 'ls'
Test repo: https://github.com/zgid123/test-mysql-data-type
Detail
I followed this PR: https://github.com/rails/rails/pull/49842 to add those two types. I still not know how to write unit test for this case. Please help me this one.
Additional information
Here the result after the fix
ActiveRecord::Schema[7.2].define(version: 2024_02_25_192506) do
create_table "tests", charset: "utf8mb3", force: :cascade do |t|
t.string "name"
t.decimal "number", precision: 10
t.linestring "ls"
t.multilinestring "mls"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
end
Checklist
Before submitting the PR make sure the following are checked:
- [x] This Pull Request is related to one change. Changes that are unrelated should be opened in separate PRs.
- [x] Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex:
[Fix #issue-number]
- [ ] Tests are added or updated if you fix a bug or add a feature.
- [ ] CHANGELOG files are updated for the changed libraries if there is a behavior change or additional feature. Minor bug fixes and documentation changes should not be included.