db_schema-definitions 0.1 → 0.1.1
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 +4 -4
- data/README.md +1 -1
- data/lib/db_schema/definitions/check_constraint.rb +4 -0
- data/lib/db_schema/definitions/field/base.rb +4 -0
- data/lib/db_schema/definitions/index.rb +10 -0
- data/lib/db_schema/definitions/table.rb +10 -0
- data/lib/db_schema/definitions/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae2df87f767542bd232c75d6b0ac42697b0d4fb8
|
4
|
+
data.tar.gz: f6f39c373daa3228b8e4b3d532a91b568e0cfe36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ada6d9fac2caba310326c2934ff79d03fc553c335c9b597790134c1b0745e3430d0c603f5112eef31de2972a1ec371117c6753081c95c271822080455d9993d8
|
7
|
+
data.tar.gz: 8023878809927aa1f241afcd8a0d79f1103b8990e9a38e04e105b4edef6901a827510a5484362634c121ae30df95f4a1401d04475683cd708e666193813bbeb1
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# DbSchema::Definitions
|
1
|
+
# DbSchema::Definitions [](https://travis-ci.org/db-schema/definitions)
|
2
2
|
|
3
3
|
This gem contains definition classes
|
4
4
|
[describing database structure](https://github.com/db-schema/core/wiki/Schema-analysis-DSL)
|
@@ -64,6 +64,10 @@ module DbSchema
|
|
64
64
|
Field.build(name, type, **options, primary_key: primary_key?, attr_name => attr_value)
|
65
65
|
end
|
66
66
|
|
67
|
+
def with_default(new_default)
|
68
|
+
Field.build(name, type, **options, primary_key: primary_key?, default: new_default)
|
69
|
+
end
|
70
|
+
|
67
71
|
class << self
|
68
72
|
def register(*types)
|
69
73
|
types.each do |type|
|
@@ -41,6 +41,16 @@ module DbSchema
|
|
41
41
|
condition: condition
|
42
42
|
)
|
43
43
|
end
|
44
|
+
|
45
|
+
def with_condition(new_condition)
|
46
|
+
Index.new(
|
47
|
+
name: name,
|
48
|
+
columns: columns,
|
49
|
+
unique: unique?,
|
50
|
+
type: type,
|
51
|
+
condition: new_condition
|
52
|
+
)
|
53
|
+
end
|
44
54
|
end
|
45
55
|
|
46
56
|
class NullIndex < Index
|
@@ -97,6 +97,16 @@ module DbSchema
|
|
97
97
|
)
|
98
98
|
end
|
99
99
|
|
100
|
+
def with_checks(new_checks)
|
101
|
+
Table.new(
|
102
|
+
name,
|
103
|
+
fields: fields,
|
104
|
+
indexes: indexes,
|
105
|
+
checks: new_checks,
|
106
|
+
foreign_keys: foreign_keys
|
107
|
+
)
|
108
|
+
end
|
109
|
+
|
100
110
|
def with_foreign_keys(new_foreign_keys)
|
101
111
|
Table.new(
|
102
112
|
name,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: db_schema-definitions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vsevolod Romashov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-equalizer
|