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
f8e904fc
authored
Jul 07, 2023
by
source_reader
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
bug fixes
parent
e117d669
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
20 additions
and
73 deletions
app/adapters/joule/update_db.rb
app/models/db_folder.rb
config/environments/development.rb
config/initializers/new_framework_defaults_6_1.rb
spec/cassettes/Joule_Backend/retrieves_database_schema.yml
spec/cassettes/ReadEvents/when_boundary_times_are_not_specified/updates_the_streams.yml
app/adapters/joule/update_db.rb
View file @
f8e904fc
...
...
@@ -39,9 +39,12 @@ module Joule
def
__update_folder
(
db_folder
,
schema
,
parent_path
)
attrs
=
schema
.
slice
(
*
DbFolder
.
defined_attributes
)
# check to see if this db_folder has changed since last update
attrs
[
:last_update
]
=
schema
[
:updated_at
].
to_datetime
if
db_folder
.
last_update
>=
attrs
[
:last_update
]
return
puts
"ignoring
#{
db_folder
.
name
}
:
#{
db_folder
.
id
}
,
#{
db_folder
.
last_update
}
>
#{
schema
[
:updated_at
]
}
"
# only do this if the joule node supports timestamps
if
not
schema
[
:updated_at
].
nil?
attrs
[
:last_update
]
=
schema
[
:updated_at
].
to_datetime
if
db_folder
.
last_update
>=
attrs
[
:last_update
]
return
puts
"ignoring
#{
db_folder
.
name
}
:
#{
db_folder
.
id
}
,
#{
db_folder
.
last_update
}
>
#{
schema
[
:updated_at
]
}
"
end
end
if
db_folder
.
id
.
nil?
puts
"creating
#{
schema
[
:name
]
}
"
...
...
@@ -111,6 +114,7 @@ module Joule
end
end
stream
||=
DbStream
.
new
(
db_folder:
db_folder
,
db:
db_folder
.
db
)
puts
"Updating
#{
stream
.
name
}
"
__update_stream
(
stream
,
stream_schema
,
db_folder
.
path
)
size_on_disk
+=
stream
.
size_on_disk
unless
stream
.
size_on_disk
.
nil?
unless
stream
.
start_time
.
nil?
...
...
@@ -165,6 +169,14 @@ module Joule
def
__update_stream
(
db_stream
,
schema
,
parent_path
)
attrs
=
schema
.
slice
(
*
DbStream
.
defined_attributes
)
# check to see if this stream has changed since last update
# only do this if the joule node supports timestamps
if
not
schema
[
:updated_at
].
nil?
attrs
[
:last_update
]
=
schema
[
:updated_at
].
to_datetime
if
db_stream
.
last_update
>=
attrs
[
:last_update
]
return
puts
"ignoring Stream
#{
db_stream
.
name
}
:
#{
db_stream
.
id
}
,
#{
db_stream
.
last_update
}
>
#{
schema
[
:updated_at
]
}
"
end
end
# add in extra attributes that require conversion
attrs
[
:path
]
=
"
#{
parent_path
}
/
#{
schema
[
:name
]
}
"
attrs
[
:data_type
]
=
"
#{
schema
[
:datatype
].
downcase
}
_
#{
schema
[
:elements
].
count
}
"
...
...
app/models/db_folder.rb
View file @
f8e904fc
...
...
@@ -5,7 +5,7 @@
# a folder in the database, may contain one or more DbFiles as files
# and one or more DbFolders as subfolders
class
DbFolder
<
ApplicationRecord
belongs_to
:parent
,
class_name:
'DbFolder'
,
optional:
true
belongs_to
:parent
,
class_name:
'DbFolder'
,
optional:
true
,
dependent: :destroy
belongs_to
:db
,
optional:
false
has_many
:subfolders
,
...
...
config/environments/development.rb
View file @
f8e904fc
...
...
@@ -77,6 +77,8 @@ Rails.application.configure do
end
end
config
.
web_console
.
permissions
=
'192.168.64.1'
# ------- Lumen Custom Settings ----------
#
...
...
config/initializers/new_framework_defaults_6_1.rb
deleted
100644 → 0
View file @
e117d669
# Be sure to restart your server when you modify this file.
#
# This file contains migration options to ease your Rails 6.1 upgrade.
#
# Once upgraded flip defaults one by one to migrate to the new default.
#
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
# Support for inversing belongs_to -> has_many Active Record associations.
Rails
.
application
.
config
.
active_record
.
has_many_inversing
=
true
# Track Active Storage variants in the database.
Rails
.
application
.
config
.
active_storage
.
track_variants
=
true
# Apply random variation to the delay when retrying failed jobs.
Rails
.
application
.
config
.
active_job
.
retry_jitter
=
0.15
# Stop executing `after_enqueue`/`after_perform` callbacks if
# `before_enqueue`/`before_perform` respectively halts with `throw :abort`.
Rails
.
application
.
config
.
active_job
.
skip_after_callbacks_if_terminated
=
true
# Specify cookies SameSite protection level: either :none, :lax, or :strict.
#
# This change is not backwards compatible with earlier Rails versions.
# It's best enabled when your entire app is migrated and stable on 6.1.
Rails
.
application
.
config
.
action_dispatch
.
cookies_same_site_protection
=
:lax
# Generate CSRF tokens that are encoded in URL-safe Base64.
#
# This change is not backwards compatible with earlier Rails versions.
# It's best enabled when your entire app is migrated and stable on 6.1.
Rails
.
application
.
config
.
action_controller
.
urlsafe_csrf_tokens
=
true
# Specify whether `ActiveSupport::TimeZone.utc_to_local` returns a time with an
# UTC offset or a UTC time.
ActiveSupport
.
utc_to_local_returns_utc_offset_times
=
true
# Change the default HTTP status code to `308` when redirecting non-GET/HEAD
# requests to HTTPS in `ActionDispatch::SSL` middleware.
Rails
.
application
.
config
.
action_dispatch
.
ssl_default_redirect_status
=
308
# Use new connection handling API. For most applications this won't have any
# effect. For applications using multiple databases, this new API provides
# support for granular connection swapping.
Rails
.
application
.
config
.
active_record
.
legacy_connection_handling
=
false
# Make `form_with` generate non-remote forms by default.
Rails
.
application
.
config
.
action_view
.
form_with_generates_remote_forms
=
false
# Set the default queue name for the analysis job to the queue adapter default.
Rails
.
application
.
config
.
active_storage
.
queues
.
analysis
=
nil
# Set the default queue name for the purge job to the queue adapter default.
Rails
.
application
.
config
.
active_storage
.
queues
.
purge
=
nil
# Set the default queue name for the incineration job to the queue adapter default.
Rails
.
application
.
config
.
action_mailbox
.
queues
.
incineration
=
nil
# Set the default queue name for the routing job to the queue adapter default.
Rails
.
application
.
config
.
action_mailbox
.
queues
.
routing
=
nil
# Set the default queue name for the mail deliver job to the queue adapter default.
Rails
.
application
.
config
.
action_mailer
.
deliver_later_queue_name
=
nil
# Generate a `Link` header that gives a hint to modern browsers about
# preloading assets when using `javascript_include_tag` and `stylesheet_link_tag`.
Rails
.
application
.
config
.
action_view
.
preload_links_header
=
true
spec/cassettes/Joule_Backend/retrieves_database_schema.yml
View file @
f8e904fc
...
...
@@ -2,7 +2,7 @@
http_interactions
:
-
request
:
method
:
get
uri
:
https://localhost:3030/
stream
s.json
uri
:
https://localhost:3030/
folder
s.json
body
:
encoding
:
US-ASCII
string
:
'
'
...
...
spec/cassettes/ReadEvents/when_boundary_times_are_not_specified/updates_the_streams.yml
View file @
f8e904fc
...
...
@@ -67,7 +67,7 @@ http_interactions:
recorded_at
:
Mon, 08 Mar 2021 21:26:42 GMT
-
request
:
method
:
get
uri
:
https://localhost:3030/
stream
s.json
uri
:
https://localhost:3030/
folder
s.json
body
:
encoding
:
US-ASCII
string
:
'
'
...
...
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