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
66fc4c14
authored
Aug 16, 2023
by
John Donnal
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
added active attribute to data streams
parent
62b52f37
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
3 deletions
app/adapters/joule/update_db.rb
app/models/db_stream.rb
db/migrate/20230816022450_add_active_field_to_db_stream.rb
db/schema.rb
app/adapters/joule/update_db.rb
View file @
66fc4c14
...
@@ -27,6 +27,13 @@ module Joule
...
@@ -27,6 +27,13 @@ module Joule
# go through the schema and update the database
# go through the schema and update the database
@db
.
root_folder
||=
DbFolder
.
create
(
db:
@db
)
@db
.
root_folder
||=
DbFolder
.
create
(
db:
@db
)
__update_folder
(
@db
.
root_folder
,
schema
,
''
)
__update_folder
(
@db
.
root_folder
,
schema
,
''
)
if
not
schema
[
:active_data_streams
].
nil?
active_stream_ids
=
schema
[
:active_data_streams
]
# activate currently inactive streams
DbStream
.
where
(
db_id:
@db
.
id
,
active:
false
,
joule_id:
active_stream_ids
).
update
(
active:
true
)
# deactivate streams that are no longer active
DbStream
.
where
(
db_id:
@db
.
id
,
active:
true
).
where
.
not
(
joule_id:
active_stream_ids
).
update
(
active:
false
)
end
DbStream
.
destroy
(
@deleted_db_streams
)
DbStream
.
destroy
(
@deleted_db_streams
)
EventStream
.
destroy
(
@deleted_event_streams
)
EventStream
.
destroy
(
@deleted_event_streams
)
DbFolder
.
destroy
(
@deleted_folders
)
DbFolder
.
destroy
(
@deleted_folders
)
...
...
app/models/db_stream.rb
View file @
66fc4c14
...
@@ -28,7 +28,7 @@ class DbStream < ApplicationRecord
...
@@ -28,7 +28,7 @@ class DbStream < ApplicationRecord
validates_with
DbDataTypeValidator
validates_with
DbDataTypeValidator
def
self
.
defined_attributes
def
self
.
defined_attributes
[
:name
,
:name_abbrev
,
:description
,
:hidden
,
:data_type
,
:locked
]
[
:name
,
:name_abbrev
,
:description
,
:hidden
,
:data_type
,
:locked
,
:active
]
end
end
def
data_format
def
data_format
...
@@ -47,7 +47,7 @@ class DbStream < ApplicationRecord
...
@@ -47,7 +47,7 @@ class DbStream < ApplicationRecord
end
end
def
self
.
json_keys
def
self
.
json_keys
[
:id
,
:name
,
:description
,
:path
,
:start_time
,
[
:id
,
:name
,
:description
,
:path
,
:start_time
,
:active
,
:end_time
,
:size_on_disk
,
:total_rows
,
:total_time
,
:end_time
,
:size_on_disk
,
:total_rows
,
:total_time
,
:data_type
,
:name_abbrev
,
:delete_locked
,
:locked
,
:hidden
]
:data_type
,
:name_abbrev
,
:delete_locked
,
:locked
,
:hidden
]
end
end
...
...
db/migrate/20230816022450_add_active_field_to_db_stream.rb
0 → 100644
View file @
66fc4c14
class
AddActiveFieldToDbStream
<
ActiveRecord
::
Migration
[
7.0
]
def
change
add_column
:db_streams
,
:active
,
:boolean
,
default:
false
end
end
db/schema.rb
View file @
66fc4c14
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
#
#
# It's strongly recommended that you check this file into your version control system.
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
[
7.0
].
define
(
version:
2023_0
6_23_142722
)
do
ActiveRecord
::
Schema
[
7.0
].
define
(
version:
2023_0
8_16_022450
)
do
create_table
"data_apps"
,
force: :cascade
do
|
t
|
create_table
"data_apps"
,
force: :cascade
do
|
t
|
t
.
string
"name"
t
.
string
"name"
t
.
string
"joule_id"
t
.
string
"joule_id"
...
@@ -103,6 +103,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_06_23_142722) do
...
@@ -103,6 +103,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_06_23_142722) do
t
.
integer
"joule_id"
t
.
integer
"joule_id"
t
.
boolean
"locked"
t
.
boolean
"locked"
t
.
datetime
"last_update"
,
default:
"1970-01-01 00:00:00"
t
.
datetime
"last_update"
,
default:
"1970-01-01 00:00:00"
t
.
boolean
"active"
,
default:
false
t
.
index
[
"joule_id"
],
name:
"index_db_streams_on_joule_id"
t
.
index
[
"joule_id"
],
name:
"index_db_streams_on_joule_id"
end
end
...
...
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