Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
8479b79a
R
rails
项目概览
张重言
/
rails
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rails
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
8479b79a
编写于
10月 29, 2017
作者:
R
Ryuta Kamizono
提交者:
GitHub
10月 29, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #31007 from suginoy/doc_integer_bigint
[ci skip]Update the documentation about the primary key type
上级
e4eaf8fa
aa0865a8
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
20 addition
and
20 deletion
+20
-20
activerecord/README.rdoc
activerecord/README.rdoc
+1
-1
activerecord/lib/active_record/associations.rb
activerecord/lib/active_record/associations.rb
+3
-3
activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
..._record/connection_adapters/abstract/schema_statements.rb
+15
-15
activerecord/lib/active_record/connection_adapters/column.rb
activerecord/lib/active_record/connection_adapters/column.rb
+1
-1
未找到文件。
activerecord/README.rdoc
浏览文件 @
8479b79a
...
...
@@ -26,7 +26,7 @@ The Product class is automatically mapped to the table named "products",
which might look like this:
CREATE TABLE products (
id int NOT NULL auto_increment,
id
big
int NOT NULL auto_increment,
name varchar(255),
PRIMARY KEY (id)
);
...
...
activerecord/lib/active_record/associations.rb
浏览文件 @
8479b79a
...
...
@@ -483,14 +483,14 @@ def association_instance_set(name, association)
# The tables for these classes could look something like:
#
# CREATE TABLE users (
# id int NOT NULL auto_increment,
# account_id int default NULL,
# id
big
int NOT NULL auto_increment,
# account_id
big
int default NULL,
# name varchar default NULL,
# PRIMARY KEY (id)
# )
#
# CREATE TABLE accounts (
# id int NOT NULL auto_increment,
# id
big
int NOT NULL auto_increment,
# name varchar default NULL,
# PRIMARY KEY (id)
# )
...
...
activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
浏览文件 @
8479b79a
...
...
@@ -216,7 +216,7 @@ def primary_key(table_name)
# generates:
#
# CREATE TABLE suppliers (
# id int auto_increment PRIMARY KEY
# id
big
int auto_increment PRIMARY KEY
# ) ENGINE=InnoDB DEFAULT CHARSET=utf8
#
# ====== Rename the primary key column
...
...
@@ -228,7 +228,7 @@ def primary_key(table_name)
# generates:
#
# CREATE TABLE objects (
# guid int auto_increment PRIMARY KEY,
# guid
big
int auto_increment PRIMARY KEY,
# name varchar(80)
# )
#
...
...
@@ -255,8 +255,8 @@ def primary_key(table_name)
# generates:
#
# CREATE TABLE order (
# product_id
integer
NOT NULL,
# client_id
integer
NOT NULL
# product_id
bigint
NOT NULL,
# client_id
bigint
NOT NULL
# );
#
# ALTER TABLE ONLY "orders"
...
...
@@ -265,15 +265,15 @@ def primary_key(table_name)
# ====== Do not add a primary key column
#
# create_table(:categories_suppliers, id: false) do |t|
# t.column :category_id, :
integer
# t.column :supplier_id, :
integer
# t.column :category_id, :
bigint
# t.column :supplier_id, :
bigint
# end
#
# generates:
#
# CREATE TABLE categories_suppliers (
# category_id int,
# supplier_id int
# category_id
big
int,
# supplier_id
big
int
# )
#
# ====== Create a temporary table based on a query
...
...
@@ -361,8 +361,8 @@ def create_table(table_name, comment: nil, **options)
# generates:
#
# CREATE TABLE assemblies_parts (
# assembly_id int NOT NULL,
# part_id int NOT NULL,
# assembly_id
big
int NOT NULL,
# part_id
big
int NOT NULL,
# ) ENGINE=InnoDB DEFAULT CHARSET=utf8
#
def
create_join_table
(
table_1
,
table_2
,
column_options:
{},
**
options
)
...
...
@@ -432,7 +432,7 @@ def drop_join_table(table_1, table_2, options = {})
# t.references :company
# end
#
# Creates a <tt>company_id(
integer
)</tt> column.
# Creates a <tt>company_id(
bigint
)</tt> column.
#
# ====== Add a polymorphic foreign key column
#
...
...
@@ -440,7 +440,7 @@ def drop_join_table(table_1, table_2, options = {})
# t.belongs_to :company, polymorphic: true
# end
#
# Creates <tt>company_type(varchar)</tt> and <tt>company_id(
integer
)</tt> columns.
# Creates <tt>company_type(varchar)</tt> and <tt>company_id(
bigint
)</tt> columns.
#
# ====== Remove a column
#
...
...
@@ -811,14 +811,14 @@ def index_name_exists?(table_name, index_name)
indexes
(
table_name
).
detect
{
|
i
|
i
.
name
==
index_name
}
end
# Adds a reference. The reference column is a
n integer
by default,
# Adds a reference. The reference column is a
bigint
by default,
# the <tt>:type</tt> option can be used to specify a different type.
# Optionally adds a +_type+ column, if <tt>:polymorphic</tt> option is provided.
# #add_reference and #add_belongs_to are acceptable.
#
# The +options+ hash can include the following keys:
# [<tt>:type</tt>]
# The reference column type. Defaults to +:
integer
+.
# The reference column type. Defaults to +:
bigint
+.
# [<tt>:index</tt>]
# Add an appropriate index. Defaults to true.
# See #add_index for usage of this option.
...
...
@@ -829,7 +829,7 @@ def index_name_exists?(table_name, index_name)
# [<tt>:null</tt>]
# Whether the column allows nulls. Defaults to true.
#
# ====== Create a user_id
integer
column
# ====== Create a user_id
bigint
column
#
# add_reference(:products, :user)
#
...
...
activerecord/lib/active_record/connection_adapters/column.rb
浏览文件 @
8479b79a
...
...
@@ -11,7 +11,7 @@ class Column
# Instantiates a new column in the table.
#
# +name+ is the column's name, such as <tt>supplier_id</tt> in <tt>supplier_id int</tt>.
# +name+ is the column's name, such as <tt>supplier_id</tt> in <tt>supplier_id
big
int</tt>.
# +default+ is the type-casted default value, such as +new+ in <tt>sales_stage varchar(20) default 'new'</tt>.
# +sql_type_metadata+ is various information about the type of the column
# +null+ determines if this column allows +NULL+ values.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录