Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP remove service install #1871

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft

WIP remove service install #1871

wants to merge 3 commits into from

Conversation

otaviojacobi
Copy link
Contributor

No description provided.

@otaviojacobi otaviojacobi changed the title Remove dsev fk to si Rewrite dsev table on resin Nov 28, 2024
@otaviojacobi otaviojacobi changed the title Rewrite dsev table on resin Rewrite dsev table on balena Nov 28, 2024
@otaviojacobi otaviojacobi force-pushed the remove-dsev-fk-to-si branch 2 times, most recently from 558dfa4 to 2813558 Compare November 29, 2024 14:23
Comment on lines 28 to 52
[
'From',
[
'Alias',
// TODO: should this be changed from table to resource? How?
['Table', 'device service environment variable'],
'dsev',
],
],
[
'Join',
[
'Alias',
// TODO: should this be changed from table to resource? How?
['Table', 'service install'],
'si',
],
[
'On',
[
'And',
[
'Equals',
['ReferencedField', 'dsev', 'device'],
['ReferencedField', 'si', 'device'],
],
[
'Equals',
['ReferencedField', 'dsev', 'service'],
['ReferencedField', 'si', 'installs-service'],
],
],
],
],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this is joining all desv & service installs, on every dsev row.
You should be able to reference the dsev resource that's on the current context of this query w/ something like:

Suggested change
[
'From',
[
'Alias',
// TODO: should this be changed from table to resource? How?
['Table', 'device service environment variable'],
'dsev',
],
],
[
'Join',
[
'Alias',
// TODO: should this be changed from table to resource? How?
['Table', 'service install'],
'si',
],
[
'On',
[
'And',
[
'Equals',
['ReferencedField', 'dsev', 'device'],
['ReferencedField', 'si', 'device'],
],
[
'Equals',
['ReferencedField', 'dsev', 'service'],
['ReferencedField', 'si', 'installs-service'],
],
],
],
],
[
'From',
[
'Alias',
// TODO: should this be changed from table to resource? How?
['Table', 'service install'],
'si',
],
],
[
'Where',
[
'And',
[
'Equals',
// If you generate the v7 abstract sql model you should be able to find exactly what's the correct name to use in v7
// this references the resource of the current context - ie where this abstract sql is going to be injected.
['ReferencedField', 'device-installs-application-has-service name-has-name'', 'device'],
['ReferencedField', 'si', 'device'],
],
[
'Equals',
['ReferencedField', 'device-installs-application-has-service name-has-name'', 'service'],
['ReferencedField', 'si', 'installs-service'],
],
],
],

Eg:

['ReferencedField', 'device', 'id'],

@otaviojacobi otaviojacobi force-pushed the remove-dsev-fk-to-si branch 2 times, most recently from fd6493a to 1aed2a5 Compare November 29, 2024 14:56
@thgreasi
Copy link
Member

You should probably also rename the commit to something like:
Add a v7 translation for device_service_environment_variable.service_install

@otaviojacobi
Copy link
Contributor Author

You should probably also rename the commit to something like: Add a v7 translation for device_service_environment_variable.service_install

This is just a test branch where I am accumulating changes. I will PR each possibly independent change in its standalone PRs

@otaviojacobi otaviojacobi changed the title Rewrite dsev table on balena WIP remove service install Nov 29, 2024
@otaviojacobi otaviojacobi force-pushed the remove-dsev-fk-to-si branch 2 times, most recently from 8619c2c to d2f9fce Compare November 29, 2024 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants