mirror of https://github.com/rails/rails
Add some description for MariaDB in ActiveRecord documentation
This enhancement aims to improve the accuracy and completeness of the documentation, providing users with comprehensive guidance across different database platforms. The changes ensure that users are aware of MariaDB compatibility for primary key column type, explain options, and information about multiple column indexes.
This commit is contained in:
parent
89adf24a57
commit
d77a49c837
|
@ -130,9 +130,9 @@ Active Record uses conventions for column names in the database tables as well,
|
|||
depending on the purpose of these columns.
|
||||
|
||||
* **Primary keys** - By default, Active Record will use an integer column named
|
||||
`id` as the table's primary key (`bigint` for PostgreSQL and MySQL, `integer`
|
||||
for SQLite). When using [Active Record Migrations](#migrations) to create your
|
||||
tables, this column will be automatically created.
|
||||
`id` as the table's primary key (`bigint` for PostgreSQL, MySQL, and MariaDB,
|
||||
`integer` for SQLite). When using [Active Record Migrations](#migrations) to
|
||||
create your tables, this column will be automatically created.
|
||||
* **Foreign keys** - These fields should be named following the pattern
|
||||
`singularized_table_name_id` (e.g., `order_id`, `line_item_id`). These are the
|
||||
fields that Active Record will look for when you create associations between
|
||||
|
@ -657,8 +657,8 @@ class CreatePublications < ActiveRecord::Migration[7.2]
|
|||
end
|
||||
```
|
||||
|
||||
Note that the above code is database-agnostic: it will run in MySQL, PostgreSQL,
|
||||
SQLite, and others.
|
||||
Note that the above code is database-agnostic: it will run in MySQL, MariaDB,
|
||||
PostgreSQL, SQLite, and others.
|
||||
|
||||
Rails keeps track of which migrations have been committed to the database and
|
||||
stores them in a neighboring table in that same database called
|
||||
|
|
|
@ -2714,7 +2714,7 @@ and may yield this for PostgreSQL:
|
|||
|
||||
### Explain Options
|
||||
|
||||
For databases and adapters which support them (currently PostgreSQL and MySQL), options can be passed to provide deeper analysis.
|
||||
For databases and adapters which support them (currently PostgreSQL, MySQL, and MariaDB), options can be passed to provide deeper analysis.
|
||||
|
||||
Using PostgreSQL, the following:
|
||||
|
||||
|
|
|
@ -762,9 +762,9 @@ In order to add a uniqueness database constraint on your database, use the
|
|||
|
||||
Should you wish to create a database constraint to prevent possible violations
|
||||
of a uniqueness validation using the `:scope` option, you must create a unique
|
||||
index on both columns in your database. See [the MySQL manual][] for more
|
||||
details about multiple column indexes or [the PostgreSQL manual][] for examples
|
||||
of unique constraints that refer to a group of columns.
|
||||
index on both columns in your database. See [the MySQL manual][] and [the MariaDB
|
||||
manual][] for more details about multiple column indexes, or [the PostgreSQL
|
||||
manual][] for examples of unique constraints that refer to a group of columns.
|
||||
|
||||
There is also a `:case_sensitive` option that you can use to define whether the
|
||||
uniqueness constraint will be case sensitive, case insensitive, or if it should
|
||||
|
@ -791,6 +791,7 @@ See [`validates_uniqueness_of`][] for more information.
|
|||
[`validates_uniqueness_of`]: https://api.rubyonrails.org/classes/ActiveRecord/Validations/ClassMethods.html#method-i-validates_uniqueness_of
|
||||
[`add_index`]: https://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/SchemaStatements.html#method-i-add_index
|
||||
[the MySQL manual]: https://dev.mysql.com/doc/refman/en/multiple-column-indexes.html
|
||||
[the MariaDB manual]: https://mariadb.com/kb/en/compound-composite-indexes/
|
||||
[the PostgreSQL manual]: https://www.postgresql.org/docs/current/static/ddl-constraints.html
|
||||
|
||||
### `validates_associated`
|
||||
|
|
Loading…
Reference in New Issue