You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use partition table on MySQL. Partition table have composite key.
This column set AUTO_INCREMENT.
but it not wrote auto_increment: true on db/schema.rb.
Steps to reproduce
class CreateArticles < ActiveRecord::Migration[5.1]
def up
create_table :articles, id: false do |t|
t.integer :id, null: false
t.datetime :posted_at, null: false
t.text :content, null: false
end
execute 'ALTER TABLE articles ADD PRIMARY KEY(id, posted_at);'
execute 'ALTER TABLE articles MODIFY id BIGINT(20) NOT NULL AUTO_INCREMENT;'
end
end
mysql>DESC articles;
+-----------+------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------+------------+------+-----+---------+----------------+
| id | bigint(20) | NO | PRI | NULL | auto_increment |
| posted_at | datetime | NO | PRI | NULL | |
| content | text | NO | | NULL | |
+-----------+------------+------+-----+---------+----------------+
Currently `AUTO_INCREMENT` is implicitly used in the default primary key
definition. But `AUTO_INCREMENT` is not only used for single column
primary key, but also for composite primary key. In that case,
`auto_increment: true` should be dumped explicitly in the
`db/schema.rb`.
Fixes#30894.
I use partition table on MySQL. Partition table have composite key.
This column set
AUTO_INCREMENT
.but it not wrote
auto_increment: true
on db/schema.rb
.Steps to reproduce
Expected behavior
Actual behavior
missing
auto_increment: true
...System configuration
Rails version: 5.1.4
Ruby version: 2.4.2
MySQL version: 2.4.2
mysql2 gem version: 0.4.9
The text was updated successfully, but these errors were encountered: