chrono_forge 0.4.0 → 0.5.0
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/lib/chrono_forge/error_log.rb +1 -1
- data/lib/chrono_forge/execution_log.rb +1 -1
- data/lib/chrono_forge/version.rb +1 -1
- data/lib/chrono_forge/workflow.rb +1 -1
- data/lib/chrono_forge.rb +2 -0
- data/lib/generators/chrono_forge/install/templates/install_chrono_forge.rb +46 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9da8de8f1664f4234f1a87cd69b1f32a2ccf96ce8501be4ef0e5f9585ceb7417
|
4
|
+
data.tar.gz: afe72783ec386e3aa9b5f3b79e468c83eb5bc2dd144634f797a882760a4f6eac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b24ef7eb8e7b2c2a07a368efde14bdfb54c4e846b1da9681013d23f3159693497f42d373aea3e85b6db340e737a03d907e8d745e4a3424843ecad7c8daa6e4b6
|
7
|
+
data.tar.gz: 742063a706c815f8f9a568fe2ee40f774d1510c3d46f2cdc90dd5f83304b8feeeb937c363d9f07ae19f2d8fbb75dcc33db57e9eecedc714f0a9f6dba19113da0
|
data/lib/chrono_forge/version.rb
CHANGED
@@ -22,7 +22,7 @@
|
|
22
22
|
# index_chrono_forge_workflows_on_key (key) UNIQUE
|
23
23
|
#
|
24
24
|
module ChronoForge
|
25
|
-
class Workflow <
|
25
|
+
class Workflow < ApplicationRecord()
|
26
26
|
self.table_name = "chrono_forge_workflows"
|
27
27
|
|
28
28
|
has_many :execution_logs, -> { order(id: :asc) }, dependent: :destroy
|
data/lib/chrono_forge.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
class InstallChronoForge < ActiveRecord::Migration[7.1]
|
4
4
|
def change
|
5
|
-
create_table :chrono_forge_workflows do |t|
|
5
|
+
create_table :chrono_forge_workflows, id: primary_key_type do |t|
|
6
6
|
t.string :key, null: false, index: true
|
7
7
|
t.string :job_class, null: false
|
8
8
|
|
@@ -27,18 +27,23 @@ class InstallChronoForge < ActiveRecord::Migration[7.1]
|
|
27
27
|
t.index %i[job_class key], unique: true
|
28
28
|
end
|
29
29
|
|
30
|
-
create_table :chrono_forge_execution_logs do |t|
|
31
|
-
t.references :workflow, null: false,
|
30
|
+
create_table :chrono_forge_execution_logs, id: primary_key_type do |t|
|
31
|
+
t.references :workflow, null: false,
|
32
|
+
foreign_key: {to_table: :chrono_forge_workflows},
|
33
|
+
type: reference_type
|
34
|
+
|
32
35
|
t.string :step_name, null: false
|
33
36
|
t.integer :attempts, null: false, default: 0
|
34
37
|
t.datetime :started_at
|
35
38
|
t.datetime :last_executed_at
|
36
39
|
t.datetime :completed_at
|
40
|
+
|
37
41
|
if t.respond_to?(:jsonb)
|
38
42
|
t.jsonb :metadata
|
39
43
|
else
|
40
44
|
t.json :metadata
|
41
45
|
end
|
46
|
+
|
42
47
|
t.integer :state, null: false, default: 0
|
43
48
|
t.string :error_class
|
44
49
|
t.text :error_message
|
@@ -47,11 +52,15 @@ class InstallChronoForge < ActiveRecord::Migration[7.1]
|
|
47
52
|
t.index %i[workflow_id step_name], unique: true
|
48
53
|
end
|
49
54
|
|
50
|
-
create_table :chrono_forge_error_logs do |t|
|
51
|
-
t.references :workflow, null: false,
|
55
|
+
create_table :chrono_forge_error_logs, id: primary_key_type do |t|
|
56
|
+
t.references :workflow, null: false,
|
57
|
+
foreign_key: {to_table: :chrono_forge_workflows},
|
58
|
+
type: reference_type
|
59
|
+
|
52
60
|
t.string :error_class
|
53
61
|
t.text :error_message
|
54
62
|
t.text :backtrace
|
63
|
+
|
55
64
|
if t.respond_to?(:jsonb)
|
56
65
|
t.jsonb :context
|
57
66
|
else
|
@@ -61,4 +70,35 @@ class InstallChronoForge < ActiveRecord::Migration[7.1]
|
|
61
70
|
t.timestamps
|
62
71
|
end
|
63
72
|
end
|
64
|
-
|
73
|
+
|
74
|
+
private
|
75
|
+
|
76
|
+
def primary_key_type
|
77
|
+
# Check if the application is configured to use UUIDs
|
78
|
+
if ActiveRecord.respond_to?(:default_id) && ActiveRecord.default_id.respond_to?(:to_s) &&
|
79
|
+
ActiveRecord.default_id.to_s.include?('uuid')
|
80
|
+
return :uuid
|
81
|
+
end
|
82
|
+
|
83
|
+
# Rails 6+ configuration style
|
84
|
+
if ActiveRecord.respond_to?(:primary_key_type) &&
|
85
|
+
ActiveRecord.primary_key_type.to_s == 'uuid'
|
86
|
+
return :uuid
|
87
|
+
end
|
88
|
+
|
89
|
+
# Check application config
|
90
|
+
app_config = Rails.application.config.generators
|
91
|
+
if app_config.options.key?(:active_record) &&
|
92
|
+
app_config.options[:active_record].key?(:primary_key_type) &&
|
93
|
+
app_config.options[:active_record][:primary_key_type].to_s == 'uuid'
|
94
|
+
return :uuid
|
95
|
+
end
|
96
|
+
|
97
|
+
# Default to traditional integer keys
|
98
|
+
return :bigint
|
99
|
+
end
|
100
|
+
|
101
|
+
def reference_type
|
102
|
+
primary_key_type == :uuid ? :uuid : nil
|
103
|
+
end
|
104
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chrono_forge
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Froelich
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|