hanami-model 1.1.0.beta1 → 1.1.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -1
- data/hanami-model.gemspec +4 -6
- data/lib/hanami-model.rb +1 -1
- data/lib/hanami/entity.rb +1 -1
- data/lib/hanami/entity/schema.rb +1 -1
- data/lib/hanami/model.rb +2 -2
- data/lib/hanami/model/associations/dsl.rb +5 -0
- data/lib/hanami/model/associations/has_many.rb +2 -3
- data/lib/hanami/model/associations/many_to_many.rb +5 -4
- data/lib/hanami/model/configuration.rb +7 -1
- data/lib/hanami/model/mapped_relation.rb +1 -1
- data/lib/hanami/model/migrator.rb +50 -5
- data/lib/hanami/model/migrator/adapter.rb +37 -6
- data/lib/hanami/model/plugins/timestamps.rb +1 -1
- data/lib/hanami/model/sql.rb +1 -1
- data/lib/hanami/model/sql/consoles/postgresql.rb +16 -4
- data/lib/hanami/model/sql/entity/schema.rb +3 -3
- data/lib/hanami/model/sql/types.rb +1 -1
- data/lib/hanami/model/types.rb +4 -3
- data/lib/hanami/model/version.rb +1 -1
- data/lib/hanami/repository.rb +5 -5
- metadata +13 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f385cfbc1d27e9ea3a846bdf7129cf257c4f1185
|
4
|
+
data.tar.gz: e1bc2f3fd9ebd76abc4d45bcddac40653ad82238
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6696bd2ae3c67d29ff897041762c5b717ff3d03c1e16bf2b42153b101f49e0670bd75a6d086912885a2ff172f07a2a2fd3064dadc0f5d83eee144354d3bc717
|
7
|
+
data.tar.gz: aa9c769a574cd41a7035014cf59eacb7803b582b771395ef9164503d3056b6a64a041f642d03117497cc09b89e0e714194d035e9a1b8eb85e696c18c9f0c8a4c
|
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,17 @@
|
|
1
1
|
# Hanami::Model
|
2
2
|
A persistence layer for Hanami
|
3
3
|
|
4
|
+
## v1.1.0.beta2 - 2017-10-03
|
5
|
+
### Added
|
6
|
+
- [Alfonso Uceda] Introduce `Hanami::Model::Migrator#rollback` to provide database migrations rollback
|
7
|
+
- [Alfonso Uceda] Improve connection string for PostgreSQL in order to pass credentials as URI query string
|
8
|
+
|
9
|
+
### Fixed
|
10
|
+
- [Marcello Rocha] One-To-Many properly destroy the associated methods
|
11
|
+
|
4
12
|
## v1.1.0.beta1 - 2017-08-11
|
5
13
|
### Added
|
6
|
-
- [Marcello Rocha]
|
14
|
+
- [Marcello Rocha] Many-To-One association (aka `belongs_to`)
|
7
15
|
- [Marcello Rocha] One-To-One association (aka `has_one`)
|
8
16
|
- [Marcello Rocha] Many-To-Many association (aka `has_many :through`)
|
9
17
|
- [Luca Guidi] Introduced new extra behaviors for entity manual schema: `:schema` (default), `:strict`, `:weak`, and `:permissive`
|
data/hanami-model.gemspec
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
1
|
lib = File.expand_path('../lib', __FILE__)
|
4
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
3
|
require 'hanami/model/version'
|
@@ -20,13 +18,13 @@ Gem::Specification.new do |spec|
|
|
20
18
|
spec.require_paths = ['lib']
|
21
19
|
spec.required_ruby_version = '>= 2.3.0'
|
22
20
|
|
23
|
-
spec.add_runtime_dependency 'hanami-utils', '1.1.0.
|
21
|
+
spec.add_runtime_dependency 'hanami-utils', '1.1.0.beta2'
|
24
22
|
spec.add_runtime_dependency 'rom-sql', '~> 1.3'
|
25
23
|
spec.add_runtime_dependency 'rom-repository', '~> 1.4'
|
26
24
|
spec.add_runtime_dependency 'dry-types', '~> 0.11'
|
27
25
|
spec.add_runtime_dependency 'concurrent-ruby', '~> 1.0'
|
28
26
|
|
29
|
-
spec.add_development_dependency 'bundler'
|
30
|
-
spec.add_development_dependency 'rake',
|
31
|
-
spec.add_development_dependency 'rspec',
|
27
|
+
spec.add_development_dependency 'bundler'
|
28
|
+
spec.add_development_dependency 'rake', '~> 12'
|
29
|
+
spec.add_development_dependency 'rspec', '~> 3.6'
|
32
30
|
end
|
data/lib/hanami-model.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require 'hanami/model'
|
1
|
+
require 'hanami/model' # rubocop:disable Naming/FileName
|
data/lib/hanami/entity.rb
CHANGED
@@ -33,7 +33,7 @@ module Hanami
|
|
33
33
|
# end
|
34
34
|
# end
|
35
35
|
#
|
36
|
-
# **Hanami::Model** ships `Hanami::Entity` for developers'
|
36
|
+
# **Hanami::Model** ships `Hanami::Entity` for developers' convenience.
|
37
37
|
#
|
38
38
|
# **Hanami::Model** depends on a narrow and well-defined interface for an
|
39
39
|
# Entity - `#id`, `#id=`, `#initialize(attributes={})`.If your object
|
data/lib/hanami/entity/schema.rb
CHANGED
@@ -95,7 +95,7 @@ module Hanami
|
|
95
95
|
class Dsl
|
96
96
|
# @since 1.1.0
|
97
97
|
# @api private
|
98
|
-
TYPES = [
|
98
|
+
TYPES = %i[schema strict weak permissive strict_with_defaults symbolized].freeze
|
99
99
|
|
100
100
|
# @since 1.1.0
|
101
101
|
# @api private
|
data/lib/hanami/model.rb
CHANGED
@@ -82,7 +82,7 @@ module Hanami
|
|
82
82
|
|
83
83
|
# Disconnect from the database
|
84
84
|
#
|
85
|
-
# This is useful for
|
85
|
+
# This is useful for rebooting applications in production and to ensure that
|
86
86
|
# the framework prunes stale connections.
|
87
87
|
#
|
88
88
|
# @since 1.0.0
|
@@ -102,7 +102,7 @@ module Hanami
|
|
102
102
|
# Hanami::Model.load!
|
103
103
|
# end
|
104
104
|
def self.disconnect
|
105
|
-
configuration.connection
|
105
|
+
configuration.connection&.disconnect
|
106
106
|
end
|
107
107
|
end
|
108
108
|
end
|
@@ -5,6 +5,8 @@ module Hanami
|
|
5
5
|
#
|
6
6
|
# @since 0.7.0
|
7
7
|
# @api private
|
8
|
+
#
|
9
|
+
# rubocop:disable Naming/PredicateName
|
8
10
|
class Dsl
|
9
11
|
# @since 0.7.0
|
10
12
|
# @api private
|
@@ -20,6 +22,8 @@ module Hanami
|
|
20
22
|
@repository.__send__(:relations, args[:through]) if args[:through]
|
21
23
|
end
|
22
24
|
|
25
|
+
# @since 1.1.0
|
26
|
+
# @api private
|
23
27
|
def has_one(relation, *)
|
24
28
|
@repository.__send__(:relations, Hanami::Utils::String.pluralize(relation).to_sym)
|
25
29
|
end
|
@@ -30,6 +34,7 @@ module Hanami
|
|
30
34
|
@repository.__send__(:relations, Hanami::Utils::String.pluralize(relation).to_sym)
|
31
35
|
end
|
32
36
|
end
|
37
|
+
# rubocop:enable Naming/PredicateName
|
33
38
|
end
|
34
39
|
end
|
35
40
|
end
|
@@ -67,9 +67,8 @@ module Hanami
|
|
67
67
|
# @since 0.7.0
|
68
68
|
# @api private
|
69
69
|
def remove(id)
|
70
|
-
|
71
|
-
|
72
|
-
command(:update, target_relation.where(target_relation.primary_key => id), use: [:timestamps])
|
70
|
+
command(:update, relation(target), use: [:timestamps])
|
71
|
+
.by_pk(id)
|
73
72
|
.call(unassociate)
|
74
73
|
end
|
75
74
|
|
@@ -90,10 +90,11 @@ module Hanami
|
|
90
90
|
association_record = relation(through)
|
91
91
|
.where(target_foreign_key => target_id, source_foreign_key => subject.fetch(source_primary_key))
|
92
92
|
.one
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
93
|
+
|
94
|
+
return if association_record.nil?
|
95
|
+
|
96
|
+
ar_id = association_record.public_send relation(through).primary_key
|
97
|
+
command(:delete, relation(through)).by_pk(ar_id).call
|
97
98
|
end
|
98
99
|
# rubocop:enable Metrics/AbcSize
|
99
100
|
|
@@ -112,7 +112,7 @@ module Hanami
|
|
112
112
|
# @since 1.0.0
|
113
113
|
# @api private
|
114
114
|
def configure_gateway
|
115
|
-
@gateway_config
|
115
|
+
@gateway_config&.call(gateway)
|
116
116
|
end
|
117
117
|
|
118
118
|
# @since 1.0.0
|
@@ -153,6 +153,12 @@ module Hanami
|
|
153
153
|
super
|
154
154
|
end
|
155
155
|
end
|
156
|
+
|
157
|
+
# @since 1.1.0
|
158
|
+
# @api private
|
159
|
+
def respond_to_missing?(method_name, include_all)
|
160
|
+
rom.respond_to?(method_name, include_all)
|
161
|
+
end
|
156
162
|
end
|
157
163
|
end
|
158
164
|
end
|
@@ -89,6 +89,7 @@ module Hanami
|
|
89
89
|
#
|
90
90
|
# @see Hanami::Model::Configuration#adapter
|
91
91
|
# @see Hanami::Model::Configuration#migrations
|
92
|
+
# @see Hanami::Model::Configuration#rollback
|
92
93
|
#
|
93
94
|
# @example Migrate Up
|
94
95
|
# require 'hanami/model'
|
@@ -116,7 +117,7 @@ module Hanami
|
|
116
117
|
# # Reads all files from "db/migrations" and apply them
|
117
118
|
# Hanami::Model::Migrator.migrate
|
118
119
|
#
|
119
|
-
# # Migrate to a
|
120
|
+
# # Migrate to a specific version
|
120
121
|
# Hanami::Model::Migrator.migrate(version: "20150610133853")
|
121
122
|
#
|
122
123
|
# NOTE: Class level interface SHOULD be removed in Hanami 2.0
|
@@ -124,6 +125,42 @@ module Hanami
|
|
124
125
|
new.migrate(version: version)
|
125
126
|
end
|
126
127
|
|
128
|
+
# Rollback database schema
|
129
|
+
#
|
130
|
+
# @param steps [Number,NilClass] number of versions to rollback
|
131
|
+
#
|
132
|
+
# @raise [Hanami::Model::MigrationError] if an error occurs
|
133
|
+
#
|
134
|
+
# @since 1.1.0
|
135
|
+
#
|
136
|
+
# @see Hanami::Model::Configuration#adapter
|
137
|
+
# @see Hanami::Model::Configuration#migrations
|
138
|
+
# @see Hanami::Model::Configuration#migrate
|
139
|
+
#
|
140
|
+
# @example Rollback
|
141
|
+
# require 'hanami/model'
|
142
|
+
# require 'hanami/model/migrator'
|
143
|
+
#
|
144
|
+
# Hanami::Model.configure do
|
145
|
+
# # ...
|
146
|
+
# adapter :sql, 'postgres://localhost/foo'
|
147
|
+
# migrations 'db/migrations'
|
148
|
+
# end
|
149
|
+
#
|
150
|
+
# # Reads all files from "db/migrations" and apply them
|
151
|
+
# Hanami::Model::Migrator.migrate
|
152
|
+
#
|
153
|
+
# # By default only rollback one version
|
154
|
+
# Hanami::Model::Migrator.rollback
|
155
|
+
#
|
156
|
+
# # Use a hash passing a number of versions to rollback, it will rollbacks those versions
|
157
|
+
# Hanami::Model::Migrator.rollback(versions: 2)
|
158
|
+
#
|
159
|
+
# NOTE: Class level interface SHOULD be removed in Hanami 2.0
|
160
|
+
def self.rollback(steps: 1)
|
161
|
+
new.rollback(steps: steps)
|
162
|
+
end
|
163
|
+
|
127
164
|
# Migrate, dump schema, delete migrations.
|
128
165
|
#
|
129
166
|
# This is an experimental feature.
|
@@ -189,7 +226,7 @@ module Hanami
|
|
189
226
|
# migrations 'db/migrations'
|
190
227
|
# end
|
191
228
|
#
|
192
|
-
# Hanami::Model::Migrator.prepare # => creates `foo' and
|
229
|
+
# Hanami::Model::Migrator.prepare # => creates `foo' and runs migrations
|
193
230
|
#
|
194
231
|
# @example Prepare Database (with schema dump)
|
195
232
|
# require 'hanami/model'
|
@@ -266,6 +303,14 @@ module Hanami
|
|
266
303
|
adapter.migrate(migrations, version) if migrations?
|
267
304
|
end
|
268
305
|
|
306
|
+
# @since 1.1.0
|
307
|
+
# @api private
|
308
|
+
#
|
309
|
+
# @see Hanami::Model::Migrator.rollback
|
310
|
+
def rollback(steps: 1)
|
311
|
+
adapter.rollback(migrations, steps.abs) if migrations?
|
312
|
+
end
|
313
|
+
|
269
314
|
# @since 0.7.0
|
270
315
|
# @api private
|
271
316
|
#
|
@@ -282,7 +327,7 @@ module Hanami
|
|
282
327
|
# @see Hanami::Model::Migrator.prepare
|
283
328
|
def prepare
|
284
329
|
drop
|
285
|
-
rescue
|
330
|
+
rescue # rubocop:disable Lint/HandleExceptions
|
286
331
|
ensure
|
287
332
|
create
|
288
333
|
adapter.load
|
@@ -297,8 +342,6 @@ module Hanami
|
|
297
342
|
adapter.version
|
298
343
|
end
|
299
344
|
|
300
|
-
private
|
301
|
-
|
302
345
|
# Hanami::Model configuration
|
303
346
|
#
|
304
347
|
# @since 0.4.0
|
@@ -307,6 +350,8 @@ module Hanami
|
|
307
350
|
Model.configuration
|
308
351
|
end
|
309
352
|
|
353
|
+
private
|
354
|
+
|
310
355
|
# @since 0.7.0
|
311
356
|
# @api private
|
312
357
|
attr_reader :configuration
|
@@ -84,6 +84,17 @@ module Hanami
|
|
84
84
|
raise MigrationError.new(e.message)
|
85
85
|
end
|
86
86
|
|
87
|
+
# @since 1.1.0
|
88
|
+
# @api private
|
89
|
+
def rollback(migrations, steps)
|
90
|
+
table = migrations_table_dataset
|
91
|
+
version = version_to_rollback(table, steps)
|
92
|
+
|
93
|
+
Sequel::Migrator.run(connection.raw, migrations, target: version, allow_missing_migration_files: true)
|
94
|
+
rescue Sequel::Migrator::Error => e
|
95
|
+
raise MigrationError.new(e.message)
|
96
|
+
end
|
97
|
+
|
87
98
|
# Load database schema.
|
88
99
|
# It must be implemented by subclasses.
|
89
100
|
#
|
@@ -100,16 +111,36 @@ module Hanami
|
|
100
111
|
# @since 0.4.0
|
101
112
|
# @api private
|
102
113
|
def version
|
103
|
-
table =
|
114
|
+
table = migrations_table_dataset
|
104
115
|
return if table.nil?
|
105
116
|
|
106
|
-
|
107
|
-
|
108
|
-
|
117
|
+
record = table.order(MIGRATIONS_TABLE_VERSION_COLUMN).last
|
118
|
+
return if record.nil?
|
119
|
+
|
120
|
+
record.fetch(MIGRATIONS_TABLE_VERSION_COLUMN).scan(MIGRATIONS_FILE_NAME_PATTERN).first.to_s
|
109
121
|
end
|
110
122
|
|
111
123
|
private
|
112
124
|
|
125
|
+
# @since 1.1.0
|
126
|
+
# @api private
|
127
|
+
MIGRATIONS_FILE_NAME_PATTERN = /\A[\d]{14}/
|
128
|
+
|
129
|
+
# @since 1.1.0
|
130
|
+
# @api private
|
131
|
+
def version_to_rollback(table, steps)
|
132
|
+
record = table.order(Sequel.desc(MIGRATIONS_TABLE_VERSION_COLUMN)).all[steps]
|
133
|
+
return 0 unless record
|
134
|
+
|
135
|
+
record.fetch(MIGRATIONS_TABLE_VERSION_COLUMN).scan(MIGRATIONS_FILE_NAME_PATTERN).first.to_i
|
136
|
+
end
|
137
|
+
|
138
|
+
# @since 1.1.0
|
139
|
+
# @api private
|
140
|
+
def migrations_table_dataset
|
141
|
+
connection.table(MIGRATIONS_TABLE)
|
142
|
+
end
|
143
|
+
|
113
144
|
# @since 0.5.0
|
114
145
|
# @api private
|
115
146
|
attr_reader :connection
|
@@ -123,10 +154,10 @@ module Hanami
|
|
123
154
|
# Returns a database connection
|
124
155
|
#
|
125
156
|
# Given a DB connection URI we can connect to a specific database or not, we need this when creating
|
126
|
-
# or
|
157
|
+
# or dropping a database. Important to notice that we can't always open a _global_ DB connection,
|
127
158
|
# because most of the times application's DB user has no rights to do so.
|
128
159
|
#
|
129
|
-
# @param global [Boolean] determine whether or not a connection should specify
|
160
|
+
# @param global [Boolean] determine whether or not a connection should specify a database.
|
130
161
|
#
|
131
162
|
# @since 0.5.0
|
132
163
|
# @api private
|
data/lib/hanami/model/sql.rb
CHANGED
@@ -36,7 +36,7 @@ module Hanami
|
|
36
36
|
# @since 0.7.0
|
37
37
|
# @api private
|
38
38
|
def host
|
39
|
-
" -h #{@uri.host}"
|
39
|
+
" -h #{query['host'] || @uri.host}"
|
40
40
|
end
|
41
41
|
|
42
42
|
# @since 0.7.0
|
@@ -48,19 +48,31 @@ module Hanami
|
|
48
48
|
# @since 0.7.0
|
49
49
|
# @api private
|
50
50
|
def port
|
51
|
-
|
51
|
+
port = query['port'] || @uri.port
|
52
|
+
" -p #{port}" if port
|
52
53
|
end
|
53
54
|
|
54
55
|
# @since 0.7.0
|
55
56
|
# @api private
|
56
57
|
def username
|
57
|
-
|
58
|
+
username = query['user'] || @uri.user
|
59
|
+
" -U #{username}" if username
|
58
60
|
end
|
59
61
|
|
60
62
|
# @since 0.7.0
|
61
63
|
# @api private
|
62
64
|
def configure_password
|
63
|
-
|
65
|
+
password = query['password'] || @uri.password
|
66
|
+
ENV[PASSWORD] = CGI.unescape(query['password'] || @uri.password) if password
|
67
|
+
end
|
68
|
+
|
69
|
+
# @since 1.1.0
|
70
|
+
# @api private
|
71
|
+
def query
|
72
|
+
return {} if @uri.query.nil? || @uri.query.empty?
|
73
|
+
|
74
|
+
parsed_query = @uri.query.split("&").map { |a| a.split("=") }
|
75
|
+
@query ||= Hash[parsed_query]
|
64
76
|
end
|
65
77
|
end
|
66
78
|
end
|
@@ -22,7 +22,7 @@ module Hanami
|
|
22
22
|
# associations and potentially to mapping defined by the repository.
|
23
23
|
#
|
24
24
|
# @param registry [Hash] a registry that keeps reference between
|
25
|
-
# entities
|
25
|
+
# entities class and their underscored names
|
26
26
|
# @param relation [ROM::Relation] the database relation
|
27
27
|
# @param mapping [Hanami::Model::Mapping] the optional repository
|
28
28
|
# mapping
|
@@ -75,7 +75,7 @@ module Hanami
|
|
75
75
|
# Build the schema
|
76
76
|
#
|
77
77
|
# @param registry [Hash] a registry that keeps reference between
|
78
|
-
# entities
|
78
|
+
# entities class and their underscored names
|
79
79
|
# @param relation [ROM::Relation] the database relation
|
80
80
|
# @param mapping [Hanami::Model::Mapping] the optional repository
|
81
81
|
# mapping
|
@@ -112,7 +112,7 @@ module Hanami
|
|
112
112
|
# Merge attributes and associations
|
113
113
|
#
|
114
114
|
# @param registry [Hash] a registry that keeps reference between
|
115
|
-
# entities
|
115
|
+
# entities class and their underscored names
|
116
116
|
# @param associations [ROM::AssociationSet] a set of associations for
|
117
117
|
# the current relation
|
118
118
|
#
|
@@ -70,7 +70,7 @@ module Hanami
|
|
70
70
|
|
71
71
|
# NOTE: In the future rom-sql should be able to always return Ruby
|
72
72
|
# types instead of Sequel types. When that will happen we can get
|
73
|
-
# rid of this logic in the block and
|
73
|
+
# rid of this logic in the block and fall back to:
|
74
74
|
#
|
75
75
|
# MAPPING.fetch(unwrapped.pristine, attribute)
|
76
76
|
MAPPING.fetch(unwrapped.pristine) do
|
data/lib/hanami/model/types.rb
CHANGED
@@ -21,7 +21,7 @@ module Hanami
|
|
21
21
|
# Define an array of given type
|
22
22
|
#
|
23
23
|
# @since 0.7.0
|
24
|
-
def Collection(type) # rubocop:disable
|
24
|
+
def Collection(type) # rubocop:disable Naming/MethodName
|
25
25
|
type = Schema::CoercibleType.new(type) unless type.is_a?(Dry::Types::Definition)
|
26
26
|
Types::Array.member(type)
|
27
27
|
end
|
@@ -48,7 +48,8 @@ module Hanami
|
|
48
48
|
# @api private
|
49
49
|
def call(value)
|
50
50
|
return if value.nil?
|
51
|
-
|
51
|
+
|
52
|
+
if valid?(value) # rubocop:disable Style/GuardClause
|
52
53
|
coerce(value)
|
53
54
|
else
|
54
55
|
raise TypeError.new("#{value.inspect} must be coercible into #{object}")
|
@@ -58,7 +59,7 @@ module Hanami
|
|
58
59
|
# Check if value can be coerced
|
59
60
|
#
|
60
61
|
# It is true if value is an instance of `object` type or if value
|
61
|
-
#
|
62
|
+
# responds to `#to_hash`.
|
62
63
|
#
|
63
64
|
# @param value [Object] the value
|
64
65
|
#
|
data/lib/hanami/model/version.rb
CHANGED
data/lib/hanami/repository.rb
CHANGED
@@ -54,7 +54,7 @@ module Hanami
|
|
54
54
|
#
|
55
55
|
# All the queries and commands are private.
|
56
56
|
# This decision forces developers to define intention revealing API, instead
|
57
|
-
#
|
57
|
+
# of leaking storage API details outside of a repository.
|
58
58
|
#
|
59
59
|
# @example
|
60
60
|
# require 'hanami/model'
|
@@ -87,7 +87,7 @@ module Hanami
|
|
87
87
|
# # * It expresses a clear intent.
|
88
88
|
# #
|
89
89
|
# # * The caller can be easily tested in isolation.
|
90
|
-
# # It's just a matter of
|
90
|
+
# # It's just a matter of stubbing this method.
|
91
91
|
# #
|
92
92
|
# # * If we change the storage, the callers aren't affected.
|
93
93
|
#
|
@@ -114,7 +114,7 @@ module Hanami
|
|
114
114
|
# @api private
|
115
115
|
#
|
116
116
|
# @see Hanami::Model::Plugins
|
117
|
-
COMMAND_PLUGINS = [
|
117
|
+
COMMAND_PLUGINS = %i[schema mapping timestamps].freeze
|
118
118
|
|
119
119
|
# Configuration
|
120
120
|
#
|
@@ -167,7 +167,7 @@ module Hanami
|
|
167
167
|
# rubocop:enable Metrics/AbcSize
|
168
168
|
# rubocop:enable Metrics/MethodLength
|
169
169
|
|
170
|
-
# Defines the
|
170
|
+
# Defines the mapping between a database table and an entity.
|
171
171
|
#
|
172
172
|
# It's also responsible to associate table columns to entity attributes.
|
173
173
|
#
|
@@ -314,7 +314,7 @@ module Hanami
|
|
314
314
|
module Commands
|
315
315
|
# Create a new record
|
316
316
|
#
|
317
|
-
# @return [Hanami::Entity]
|
317
|
+
# @return [Hanami::Entity] a new created entity
|
318
318
|
#
|
319
319
|
# @raise [Hanami::Model::Error] an error in case the command fails
|
320
320
|
#
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hanami-model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.0.
|
4
|
+
version: 1.1.0.beta2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luca Guidi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hanami-utils
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.1.0.
|
19
|
+
version: 1.1.0.beta2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.1.0.
|
26
|
+
version: 1.1.0.beta2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rom-sql
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -84,44 +84,44 @@ dependencies:
|
|
84
84
|
name: bundler
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
96
|
+
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rake
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
103
|
+
version: '12'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
110
|
+
version: '12'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rspec
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '3.
|
117
|
+
version: '3.6'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '3.
|
124
|
+
version: '3.6'
|
125
125
|
description: A persistence framework with entities and repositories
|
126
126
|
email:
|
127
127
|
- me@lucaguidi.com
|
@@ -194,7 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
194
194
|
version: 1.3.1
|
195
195
|
requirements: []
|
196
196
|
rubyforge_project:
|
197
|
-
rubygems_version: 2.6.
|
197
|
+
rubygems_version: 2.6.13
|
198
198
|
signing_key:
|
199
199
|
specification_version: 4
|
200
200
|
summary: A persistence layer for Hanami
|