declare_schema 0.12.0.pre.1 → 0.12.0.pre.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e55426213e7d15730b0531d3dba4036a4b18f3967b73a7619e60f27d15fc5b55
|
4
|
+
data.tar.gz: 294eef4ce49c912df24403ab59998e61641c681ea1e98fa6c9fa00d66a4c4502
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a3ebaa029176ff322a396baf65aaca878f631ae3ac0acad2a2290fc73275c56c312a00e1423219a30055f39ca17f1873a55f0d8be8a4dfeb38f821718c57128
|
7
|
+
data.tar.gz: 25d48b29e96b5508b52c07ca869221d506f05370a38af76994a33bbfcb67153f379b9605a60e9169876bebb63e6db5bf9acbf1f09aab900d03fc05be404cd643
|
data/Gemfile.lock
CHANGED
@@ -6,9 +6,9 @@ module DeclareSchema
|
|
6
6
|
module SchemaChange
|
7
7
|
class ColumnAdd < Base
|
8
8
|
def initialize(table_name, column_name, column_type, **column_options)
|
9
|
-
@table_name = table_name
|
10
|
-
@column_name = column_name
|
11
|
-
@column_type = column_type
|
9
|
+
@table_name = table_name or raise ArgumentError, "must provide table_name"
|
10
|
+
@column_name = column_name or raise ArgumentError, "must provide column_name"
|
11
|
+
@column_type = column_type or raise ArgumentError, "must provide column_type"
|
12
12
|
@column_options = column_options
|
13
13
|
end
|
14
14
|
|
@@ -350,7 +350,7 @@ module Generators
|
|
350
350
|
db_column_names = db_columns.keys.map(&:to_s)
|
351
351
|
|
352
352
|
to_add = model_column_names - db_column_names
|
353
|
-
to_add
|
353
|
+
to_add << pk if pk && !key_was_in_db_columns
|
354
354
|
to_remove = db_column_names - model_column_names
|
355
355
|
to_remove -= [pk.to_sym] if pk # TODO: The .to_sym here means this code is always a no-op, right? -Colin
|
356
356
|
|