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
19e4dcc9
authored
Jul 24, 2023
by
John Donnal
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
bug fix
parent
bfebc471
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
3 deletions
app/adapters/joule/update_db.rb
app/models/db.rb
app/adapters/joule/update_db.rb
View file @
19e4dcc9
...
@@ -71,7 +71,7 @@ module Joule
...
@@ -71,7 +71,7 @@ module Joule
schema
[
:children
].
each
do
|
child_schema
|
schema
[
:children
].
each
do
|
child_schema
|
child
=
db_folder
.
subfolders
.
find_by_joule_id
(
child_schema
[
:id
])
child
=
db_folder
.
subfolders
.
find_by_joule_id
(
child_schema
[
:id
])
if
child
.
nil?
# check to see if this folder has been moved from a different location
if
child
.
nil?
# check to see if this folder has been moved from a different location
child
=
DbFolder
.
find_by_joule_id
(
child_schema
[
:id
])
child
=
@db
.
db_folders
.
find_by_joule_id
(
child_schema
[
:id
])
if
not
child
.
nil?
if
not
child
.
nil?
child
.
parent
=
db_folder
child
.
parent
=
db_folder
puts
"moved
#{
child
.
name
}
to
#{
db_folder
.
name
}
"
puts
"moved
#{
child
.
name
}
to
#{
db_folder
.
name
}
"
...
@@ -106,7 +106,7 @@ module Joule
...
@@ -106,7 +106,7 @@ module Joule
schema
[
:streams
].
each
do
|
stream_schema
|
schema
[
:streams
].
each
do
|
stream_schema
|
stream
=
db_folder
.
db_streams
.
find_by_joule_id
(
stream_schema
[
:id
])
stream
=
db_folder
.
db_streams
.
find_by_joule_id
(
stream_schema
[
:id
])
if
stream
.
nil?
# check to see if this stream has been moved from a different location
if
stream
.
nil?
# check to see if this stream has been moved from a different location
stream
=
DbStream
.
find_by_joule_id
(
stream_schema
[
:id
])
stream
=
@db
.
db_streams
.
find_by_joule_id
(
stream_schema
[
:id
])
if
not
stream
.
nil?
if
not
stream
.
nil?
stream
.
db_folder
=
db_folder
stream
.
db_folder
=
db_folder
puts
"moved
#{
stream
.
name
}
to
#{
db_folder
.
name
}
"
puts
"moved
#{
stream
.
name
}
to
#{
db_folder
.
name
}
"
...
@@ -143,7 +143,7 @@ module Joule
...
@@ -143,7 +143,7 @@ module Joule
schema
[
:event_streams
].
each
do
|
stream_schema
|
schema
[
:event_streams
].
each
do
|
stream_schema
|
stream
=
db_folder
.
event_streams
.
find_by_joule_id
(
stream_schema
[
:id
])
stream
=
db_folder
.
event_streams
.
find_by_joule_id
(
stream_schema
[
:id
])
if
stream
.
nil?
# check to see if this stream has been moved from a different location
if
stream
.
nil?
# check to see if this stream has been moved from a different location
stream
=
EventStream
.
find_by_joule_id
(
stream_schema
[
:id
])
stream
=
@db
.
event_streams
.
find_by_joule_id
(
stream_schema
[
:id
])
if
not
stream
.
nil?
if
not
stream
.
nil?
stream
.
db_folder
=
db_folder
stream
.
db_folder
=
db_folder
puts
"moved
#{
stream
.
name
}
to
#{
db_folder
.
name
}
"
puts
"moved
#{
stream
.
name
}
to
#{
db_folder
.
name
}
"
...
...
app/models/db.rb
View file @
19e4dcc9
...
@@ -10,6 +10,8 @@ class Db < ApplicationRecord
...
@@ -10,6 +10,8 @@ class Db < ApplicationRecord
dependent: :destroy
dependent: :destroy
belongs_to
:nilm
belongs_to
:nilm
has_many
:db_streams
#flat map of all streams in database
has_many
:db_streams
#flat map of all streams in database
has_many
:db_folders
has_many
:event_streams
#---Validations
#---Validations
validates
:max_points_per_plot
,
numericality:
{
only_integer:
true
}
validates
:max_points_per_plot
,
numericality:
{
only_integer:
true
}
...
...
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