code0-zero_track 0.0.4 → 0.0.6

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
  SHA256:
3
- metadata.gz: 43b3e2bb45a05296028090f1046950a9f8d393e73f53d42044720ae749190e70
4
- data.tar.gz: 287c2404016ddc32bb43a727d11ea96351ae7cd5c3c9ef0e0281036a4b6f6054
3
+ metadata.gz: b8f8699266ab0945d67b73857df2ea63b2fe59a3eb97e29d1fd165d04c8d92b6
4
+ data.tar.gz: 222c86520fdf1dd39b994f34863798dc40c9f0cbb77ff81961bb947f482a35c6
5
5
  SHA512:
6
- metadata.gz: 8e87af49371a2df0b5c7dccae9d03edf9e1aed348b598857da2aa49cadb27d9cc92dad691a07e7ccbb14fced551cd87039ebd8c9ac478a9a151f4435ee1f0fa9
7
- data.tar.gz: c6baa77fcfe816711ece91fac27a34f96f1b98125fc21e085f8e10b94e3e673964c735759dc9879c4c3cb19d662076104ee54ca9905927dcc81bd5ebdd79ccb8
6
+ metadata.gz: 709fd753597fff13820c23ced5efc314edce4a2e3a473b4afb99735429a0497b6242f91ebd66c5c4f1bc7fd07f38d8f3885b5c1a691b123cf01ba0b26d347a51
7
+ data.tar.gz: b7389f87b10557fae6a7733c1e87e38c5b59375a7a1cf45f9ed2158fadf65ebdef20882733d7a63307f5527a9e03b293fbb1c2e6c2f7f5f3de7f801b178f2e44
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Code0
4
+ module ZeroTrack
5
+ module Database
6
+ module SchemaMigrations
7
+ class Formatter
8
+ def initialize(connection)
9
+ @connection = connection
10
+ end
11
+
12
+ def format(_)
13
+ # rubocop:disable Rails/SkipsModelValidations -- not an active record object
14
+ Database::SchemaMigrations.touch_all(@connection) unless Rails.env.production?
15
+ # rubocop:enable Rails/SkipsModelValidations
16
+ nil
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -4,12 +4,17 @@ module Code0
4
4
  module ZeroTrack
5
5
  module Injectors
6
6
  class ActiveRecordSchemaMigrations
7
- def self.inject!
8
- # Patch to write version information as empty files under the db/schema_migrations directory
9
- # This is intended to reduce potential for merge conflicts in db/structure.sql
10
- ActiveSupport.on_load(:active_record_postgresqladapter) do
11
- prepend Database::PostgresqlAdapter::DumpSchemaVersionsMixin
7
+ def self.inject!(config)
8
+ if Rails.gem_version >= Gem::Version.create('8.1')
9
+ config.active_record.schema_versions_formatter = Database::SchemaMigrations::Formatter
10
+ else
11
+ # Patch to write version information as empty files under the db/schema_migrations directory
12
+ # This is intended to reduce potential for merge conflicts in db/structure.sql
13
+ ActiveSupport.on_load(:active_record_postgresqladapter) do
14
+ prepend Database::PostgresqlAdapter::DumpSchemaVersionsMixin
15
+ end
12
16
  end
17
+
13
18
  # Patch to load version information from empty files under the db/schema_migrations directory
14
19
  ActiveRecord::Tasks::PostgreSQLDatabaseTasks
15
20
  .prepend Database::PostgresqlDatabaseTasks::LoadSchemaVersionsMixin
@@ -29,11 +29,31 @@ module Code0
29
29
  message.strip
30
30
  end
31
31
 
32
+ class NoOpTagStack
33
+ include Singleton
34
+
35
+ def push_tags(*)
36
+ []
37
+ end
38
+
39
+ def pop_tags(*); end
40
+
41
+ def clear; end
42
+
43
+ def format_message(message)
44
+ message
45
+ end
46
+
47
+ def tags
48
+ []
49
+ end
50
+ end
51
+
32
52
  class Tagged < JsonFormatter
33
53
  include ActiveSupport::TaggedLogging::Formatter
34
54
 
35
- def tagged(*_args)
36
- yield self # Ignore tags, they break the json layout as they are prepended to the log line
55
+ def tag_stack
56
+ NoOpTagStack.instance
37
57
  end
38
58
  end
39
59
  end
@@ -16,7 +16,7 @@ module Code0
16
16
 
17
17
  config.after_initialize do
18
18
  Injectors::ActiveRecordTimestamps.inject! if config.zero_track.active_record.timestamps
19
- Injectors::ActiveRecordSchemaMigrations.inject! if config.zero_track.active_record.schema_migrations
19
+ Injectors::ActiveRecordSchemaMigrations.inject!(config) if config.zero_track.active_record.schema_migrations
20
20
  end
21
21
  end
22
22
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Code0
4
4
  module ZeroTrack
5
- VERSION = '0.0.4'
5
+ VERSION = '0.0.6'
6
6
  end
7
7
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'active_support/core_ext/module/delegation'
3
4
  require 'rails/railtie'
4
5
 
5
6
  require 'zeitwerk'
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: code0-zero_track
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Niklas van Schrick
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-02-27 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: rails
@@ -150,7 +149,6 @@ dependencies:
150
149
  - - "~>"
151
150
  - !ruby/object:Gem::Version
152
151
  version: '2.30'
153
- description:
154
152
  email:
155
153
  - mc.taucher2003@gmail.com
156
154
  executables: []
@@ -173,6 +171,7 @@ files:
173
171
  - lib/code0/zero_track/database/schema_cleaner.rb
174
172
  - lib/code0/zero_track/database/schema_migrations.rb
175
173
  - lib/code0/zero_track/database/schema_migrations/context.rb
174
+ - lib/code0/zero_track/database/schema_migrations/formatter.rb
176
175
  - lib/code0/zero_track/database/schema_migrations/migrations.rb
177
176
  - lib/code0/zero_track/injectors/active_record_schema_migrations.rb
178
177
  - lib/code0/zero_track/injectors/active_record_timestamps.rb
@@ -198,7 +197,6 @@ metadata:
198
197
  source_code_uri: https://github.com/code0-tech/code0-zero_track
199
198
  changelog_uri: https://github.com/code0-tech/code0-zero_track/releases
200
199
  rubygems_mfa_required: 'true'
201
- post_install_message:
202
200
  rdoc_options: []
203
201
  require_paths:
204
202
  - lib
@@ -213,8 +211,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
213
211
  - !ruby/object:Gem::Version
214
212
  version: '0'
215
213
  requirements: []
216
- rubygems_version: 3.4.10
217
- signing_key:
214
+ rubygems_version: 3.6.9
218
215
  specification_version: 4
219
216
  summary: Common helpers for Code0 rails applications
220
217
  test_files: []