Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
wattsworth
/
lumen-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
fe8d739c
authored
May 12, 2022
by
John Donnal
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
added fields to events
parent
1eb49f8a
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
34 additions
and
26 deletions
app/adapters/joule/update_db.rb
app/models/event_stream.rb
db/migrate/20220430015140_modify_event_stream.rb
db/migrate/20220503020901_add_fields_to_event_stream.rb
db/migrate/20220505173955_change_event_fields_name.rb
db/schema.rb
app/adapters/joule/update_db.rb
View file @
fe8d739c
...
...
@@ -102,21 +102,6 @@ module Joule
stream
=
db_folder
.
event_streams
.
find_by_joule_id
(
stream_schema
[
:id
])
stream
||=
EventStream
.
new
(
db_folder:
db_folder
,
db:
db_folder
.
db
)
__update_event_stream
(
stream
,
stream_schema
,
db_folder
.
path
)
size_on_disk
+=
stream
.
size_on_disk
unless
stream
.
start_time
.
nil?
if
start_time
.
nil?
start_time
=
stream
.
start_time
else
start_time
=
[
stream
.
start_time
,
start_time
].
min
end
end
unless
stream
.
end_time
.
nil?
if
end_time
.
nil?
end_time
=
stream
.
end_time
else
end_time
=
[
stream
.
end_time
,
end_time
].
max
end
end
updated_ids
<<
stream_schema
[
:id
]
end
# remove any streams that are no longer in the folder
...
...
@@ -161,12 +146,10 @@ module Joule
# add in extra attributes that require conversion
attrs
[
:path
]
=
"
#{
parent_path
}
/
#{
schema
[
:name
]
}
"
attrs
[
:joule_id
]
=
schema
[
:id
]
attrs
[
:start_time
]
=
schema
[
:data_info
][
:start_time
]
attrs
[
:end_time
]
=
schema
[
:data_info
][
:end_time
]
attrs
[
:total_rows
]
=
schema
[
:data_info
][
:rows
]
attrs
[
:total_time
]
=
schema
[
:data_info
][
:total_time
]
attrs
[
:size_on_disk
]
=
schema
[
:data_info
][
:bytes
]
attrs
[
:start_time
]
=
schema
[
:data_info
][
:start
]
attrs
[
:end_time
]
=
schema
[
:data_info
][
:end
]
attrs
[
:event_count
]
=
schema
[
:data_info
][
:event_count
]
attrs
[
:event_fields_json
]
=
schema
[
:event_fields
].
to_json
event_stream
.
update
(
attrs
)
end
...
...
app/models/event_stream.rb
View file @
fe8d739c
...
...
@@ -11,8 +11,12 @@ class EventStream < ApplicationRecord
def
self
.
defined_attributes
[
:name
,
:description
]
end
def
event_fields
return
{}
if
event_fields_json
.
nil?
or
event_fields_json
.
empty?
JSON
.
parse
(
event_fields_json
)
end
def
self
.
json_keys
[
:id
,
:name
,
:description
,
:path
,
:start_time
,
:end_time
,
:
size_on_disk
,
:total_rows
,
:total_time
]
:end_time
,
:
event_count
,
:event_fields
]
end
end
\ No newline at end of file
db/migrate/20220430015140_modify_event_stream.rb
0 → 100644
View file @
fe8d739c
class
ModifyEventStream
<
ActiveRecord
::
Migration
[
6.0
]
def
change
remove_column
:event_streams
,
:total_rows
remove_column
:event_streams
,
:total_time
remove_column
:event_streams
,
:size_on_disk
add_column
:event_streams
,
:event_count
,
:integer
end
end
db/migrate/20220503020901_add_fields_to_event_stream.rb
0 → 100644
View file @
fe8d739c
class
AddFieldsToEventStream
<
ActiveRecord
::
Migration
[
6.0
]
def
change
add_column
:event_streams
,
:event_fields
,
:string
end
end
db/migrate/20220505173955_change_event_fields_name.rb
0 → 100644
View file @
fe8d739c
class
ChangeEventFieldsName
<
ActiveRecord
::
Migration
[
6.0
]
def
change
rename_column
:event_streams
,
:event_fields
,
:event_fields_json
end
end
db/schema.rb
View file @
fe8d739c
...
...
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
2022_0
1_04_010931
)
do
ActiveRecord
::
Schema
.
define
(
version:
2022_0
5_05_173955
)
do
create_table
"data_apps"
,
force: :cascade
do
|
t
|
t
.
string
"name"
...
...
@@ -126,14 +126,13 @@ ActiveRecord::Schema.define(version: 2022_01_04_010931) do
t
.
string
"path"
t
.
integer
"start_time"
,
limit:
8
t
.
integer
"end_time"
,
limit:
8
t
.
integer
"total_rows"
,
limit:
8
t
.
integer
"total_time"
,
limit:
8
t
.
integer
"size_on_disk"
,
limit:
8
t
.
integer
"joule_id"
t
.
string
"name"
t
.
string
"description"
t
.
datetime
"created_at"
,
precision:
6
,
null:
false
t
.
datetime
"updated_at"
,
precision:
6
,
null:
false
t
.
integer
"event_count"
t
.
string
"event_fields_json"
t
.
index
[
"db_folder_id"
],
name:
"index_event_streams_on_db_folder_id"
t
.
index
[
"db_id"
],
name:
"index_event_streams_on_db_id"
t
.
index
[
"joule_id"
],
name:
"index_event_streams_on_joule_id"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment