db_schema-definitions 0.1 → 0.1.1

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
  SHA1:
3
- metadata.gz: 5602f6cb4adde5c72fc904806b89d00104307a11
4
- data.tar.gz: b6e99dd29c5a3eea58c8fb780c408c0025d7ea62
3
+ metadata.gz: ae2df87f767542bd232c75d6b0ac42697b0d4fb8
4
+ data.tar.gz: f6f39c373daa3228b8e4b3d532a91b568e0cfe36
5
5
  SHA512:
6
- metadata.gz: eec9c2347e6af8edc27b1835db12332e055dcf57246e702fa70114dec64f7a23b3048ac900bf3f8bc12f45a789f06b2e9adffdf1243be0e964cff53084f88e67
7
- data.tar.gz: 2b90e7080db55ecafa6c75cb47673ed518b88864d4676a1ba6a6f7484be9d06124e2594b27f108084acaa2c7dbdf7f7a05514978cced37a6d5caf83fd0fc126f
6
+ metadata.gz: ada6d9fac2caba310326c2934ff79d03fc553c335c9b597790134c1b0745e3430d0c603f5112eef31de2972a1ec371117c6753081c95c271822080455d9993d8
7
+ data.tar.gz: 8023878809927aa1f241afcd8a0d79f1103b8990e9a38e04e105b4edef6901a827510a5484362634c121ae30df95f4a1401d04475683cd708e666193813bbeb1
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # DbSchema::Definitions
1
+ # DbSchema::Definitions [![Build Status](https://travis-ci.org/db-schema/definitions.svg?branch=master)](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)
@@ -8,6 +8,10 @@ module DbSchema
8
8
  @name = name.to_sym
9
9
  @condition = condition
10
10
  end
11
+
12
+ def with_condition(new_condition)
13
+ CheckConstraint.new(name: name, condition: new_condition)
14
+ end
11
15
  end
12
16
 
13
17
  class NullCheckConstraint < CheckConstraint
@@ -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,
@@ -1,5 +1,5 @@
1
1
  module DbSchema
2
2
  module Definitions
3
- VERSION = '0.1'
3
+ VERSION = '0.1.1'
4
4
  end
5
5
  end
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: '0.1'
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-04 00:00:00.000000000 Z
11
+ date: 2017-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-equalizer