Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RadioObservatory
LOFAR
Commits
d07d7af7
Commit
d07d7af7
authored
9 years ago
by
Jorrit Schaap
Browse files
Options
Downloads
Patches
Plain Diff
Task #8887: improved resource_views
parent
81db0fec
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
SAS/ResourceAssignment/ResourceAssignmentDatabase/sql/create_database.sql
+19
-15
19 additions, 15 deletions
...gnment/ResourceAssignmentDatabase/sql/create_database.sql
with
19 additions
and
15 deletions
SAS/ResourceAssignment/ResourceAssignmentDatabase/sql/create_database.sql
+
19
−
15
View file @
d07d7af7
...
@@ -311,13 +311,19 @@ COMMENT ON VIEW resource_allocation.resource_claim_view
...
@@ -311,13 +311,19 @@ COMMENT ON VIEW resource_allocation.resource_claim_view
CREATE
OR
REPLACE
VIEW
virtual_instrument
.
resource_view
AS
CREATE
OR
REPLACE
VIEW
virtual_instrument
.
resource_view
AS
SELECT
r
.
id
,
r
.
name
,
r
.
type_id
,
rt
.
name
as
type_name
SELECT
r
.
id
,
r
.
name
,
r
.
type_id
,
rt
.
name
AS
type_name
,
u
.
id
as
unit_id
,
u
.
units
as
unit
FROM
virtual_instrument
.
resource
r
FROM
virtual_instrument
.
resource
r
JOIN
virtual_instrument
.
resource_type
rt
ON
rt
.
id
=
r
.
type_id
;
JOIN
virtual_instrument
.
resource_type
rt
ON
rt
.
id
=
r
.
type_id
JOIN
virtual_instrument
.
unit
u
ON
rt
.
unit_id
=
u
.
id
;
ALTER
VIEW
virtual_instrument
.
resource_view
ALTER
VIEW
virtual_instrument
.
resource_view
OWNER
TO
resourceassignment
;
OWNER
TO
resourceassignment
;
COMMENT
ON
VIEW
virtual_instrument
.
resource_view
COMMENT
ON
VIEW
virtual_instrument
.
resource_view
IS
'plain view on resource table including task_type.name'
;
IS
'plain view on resource table including task_type.name
and units
'
;
CREATE
OR
REPLACE
VIEW
resource_allocation
.
resource_claim_extended_view
AS
CREATE
OR
REPLACE
VIEW
resource_allocation
.
resource_claim_extended_view
AS
...
@@ -340,20 +346,18 @@ COMMENT ON VIEW resource_allocation.resource_claim_property_view
...
@@ -340,20 +346,18 @@ COMMENT ON VIEW resource_allocation.resource_claim_property_view
IS
'plain view on resource_claim_property table, including resource_claim_property_type.name'
;
IS
'plain view on resource_claim_property table, including resource_claim_property_type.name'
;
CREATE
OR
REPLACE
VIEW
resource_monitoring
.
resource_view
AS
CREATE
OR
REPLACE
VIEW
resource_monitoring
.
resource_view
AS
SELECT
r
.
id
,
r
.
name
,
r
.
type_id
,
SELECT
rv
.
*
,
rt
.
name
AS
type_name
,
rc
.
available
AS
available_capacity
,
rc
.
id
as
resource_capacity_id
,
rc
.
available
as
available_capacity
,
rc
.
total
as
total_capacity
,
rc
.
total
-
rc
.
available
AS
used_capacity
,
u
.
units
,
rc
.
total
AS
total_capacity
,
ra
.
id
as
resource_availibility_id
,
ra
.
available
as
active
ra
.
available
AS
active
FROM
virtual_instrument
.
resource
r
FROM
virtual_instrument
.
resource_view
rv
JOIN
virtual_instrument
.
resource_type
rt
ON
rt
.
id
=
r
.
type_id
LEFT
JOIN
resource_monitoring
.
resource_capacity
rc
ON
rc
.
resource_id
=
rv
.
id
JOIN
virtual_instrument
.
unit
u
ON
u
.
id
=
rt
.
unit_id
LEFT
JOIN
resource_monitoring
.
resource_availability
ra
ON
ra
.
resource_id
=
rv
.
id
;
LEFT
JOIN
resource_monitoring
.
resource_capacity
rc
on
rc
.
resource_id
=
r
.
id
LEFT
JOIN
resource_monitoring
.
resource_availability
ra
on
ra
.
resource_id
=
r
.
id
;
ALTER
VIEW
resource_monitoring
.
resource_view
ALTER
VIEW
resource_monitoring
.
resource_view
OWNER
TO
resourceassignment
;
OWNER
TO
resourceassignment
;
COMMENT
ON
VIEW
resource_monitoring
.
resource_view
COMMENT
ON
VIEW
resource_monitoring
.
resource_view
IS
'view on resource
table
including availability
, monitored values and un
it
s
'
;
IS
'view on
virtual_instrument.
resource
_view
including availability
and capac
it
y
'
;
CREATE
OR
REPLACE
VIEW
resource_allocation
.
resource_claim_conflict_reason_view
AS
CREATE
OR
REPLACE
VIEW
resource_allocation
.
resource_claim_conflict_reason_view
AS
SELECT
rccr
.
id
,
rccr
.
resource_claim_id
,
rccr
.
conflict_reason_id
,
rc
.
resource_id
,
rc
.
task_id
,
cr
.
reason
SELECT
rccr
.
id
,
rccr
.
resource_claim_id
,
rccr
.
conflict_reason_id
,
rc
.
resource_id
,
rc
.
task_id
,
cr
.
reason
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment