schema_plus 2.0.0.pre13 → 2.0.0.pre14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1dc664ffb3d969d674d13187eb4a24ed787385c6
|
4
|
+
data.tar.gz: 0a0b00cd17a6bad153bf9a002f3360ab5410d8e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e49e502c04c11581a525c83fe450e01fb8c59c198c91d43e857574ef99d523d093b49ad5e2d4b715124e037c8db09a679e46d5b24af55eb44b0620611618d4cc
|
7
|
+
data.tar.gz: 9976e6e8f318dd66b732882128922d5bb6c51dccaf530a4eb04a86135265645ab3f9acaa5184ceb1426149546b261dbb290ff633788a019a0b2f8fdfc57cbd5f
|
data/README.md
CHANGED
@@ -35,7 +35,7 @@ See detailed documentation in each gem's README.
|
|
35
35
|
[](https://gemnasium.com/SchemaPlus/schema_plus)
|
36
36
|
|
37
37
|
|
38
|
-
> ## This is the README for schema_plus 2.0.0.
|
38
|
+
> ## This is the README for schema_plus 2.0.0.pre14
|
39
39
|
> which supports Rails >= 4.2.0. This prerelease is completely usable. It's still officially a prerelease rather than formal release because some features have yet to be migrated into their own gems.
|
40
40
|
>
|
41
41
|
> For info about the 1.x releases which support Rails 3.1, 4.0, 4.1, and 4.2.0, see the [schema_plus 1.x](https://github.com/SchemaPlus/schema_plus/tree/1.x) branch
|
@@ -33,6 +33,7 @@ module SchemaPlus::ForeignKeys
|
|
33
33
|
|
34
34
|
options = options.dup
|
35
35
|
options[:column] ||= foreign_key_column_for(to_table)
|
36
|
+
options[:name] ||= ForeignKeyDefinition.default_name(from_table, options[:column])
|
36
37
|
|
37
38
|
foreign_key_sql = add_foreign_key_sql(from_table, to_table, options)
|
38
39
|
execute "ALTER TABLE #{quote_table_name(from_table)} #{foreign_key_sql}"
|
data/lib/schema_plus/version.rb
CHANGED
@@ -553,6 +553,12 @@ describe ActiveRecord::Migration do
|
|
553
553
|
SchemaPlus::ForeignKeys.config.on_delete = nil
|
554
554
|
end
|
555
555
|
|
556
|
+
it "should create foreign key with default name" do
|
557
|
+
add_column(:post_id, :integer) do
|
558
|
+
expect(@model).to reference(:posts, :id).with_name("fk_#{@model.table_name}_post_id")
|
559
|
+
end
|
560
|
+
end
|
561
|
+
|
556
562
|
protected
|
557
563
|
def add_column(column_name, *args)
|
558
564
|
table = @model.table_name
|