Skip to content

Commit

Permalink
is_pinned_on__release: stop setting device should_be_running__release…
Browse files Browse the repository at this point in the history
… and remove it from the sbvr

Change-type: major
  • Loading branch information
Andrea Rosci authored and Andrea Rosci committed Jul 11, 2024
1 parent 1aa5c9d commit f17aead
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 34 deletions.
4 changes: 0 additions & 4 deletions src/balena-init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@ CREATE INDEX IF NOT EXISTS "device_device_type_idx"
ON "device" ("is of-device type");
CREATE INDEX IF NOT EXISTS "device_is_running_release_idx"
ON "device" ("is running-release");
-- Also optimizes should be running successful release rule
-- TODO: remove device_should_be_running_release_application_idx as soon as the is_pinned_on_release migration is ended
CREATE INDEX IF NOT EXISTS "device_should_be_running_release_application_idx"
ON "device" ("should be running-release", "belongs to-application");
-- Also optimizes is pinned on successful release rule
CREATE INDEX IF NOT EXISTS "device_is_pinned_on_release_application_idx"
ON "device" ("is pinned on-release", "belongs to-application");
Expand Down
7 changes: 0 additions & 7 deletions src/balena-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -730,11 +730,6 @@ export interface Device {
| [ServiceInstance['Read']]
| []
| null;
should_be_running__release:
| { __id: Release['Read']['id'] }
| [Release['Read']]
| []
| null;
is_pinned_on__release:
| { __id: Release['Read']['id'] }
| [Release['Read']]
Expand Down Expand Up @@ -811,7 +806,6 @@ export interface Device {
api_port: Types['Integer']['Write'] | null;
api_secret: Types['Short Text']['Write'] | null;
is_managed_by__service_instance: ServiceInstance['Write']['id'] | null;
should_be_running__release: Release['Write']['id'] | null;
is_pinned_on__release: Release['Write']['id'] | null;
should_be_operated_by__release: Release['Write']['id'] | null;
should_be_managed_by__release: Release['Write']['id'] | null;
Expand Down Expand Up @@ -1019,7 +1013,6 @@ export interface Release {
release_image?: Array<ImageIsPartOfRelease['Read']>;
contains__image?: Array<ImageIsPartOfRelease['Read']>;
should_be_running_on__application?: Array<Application['Read']>;
should_be_running_on__device?: Array<Device['Read']>;
is_running_on__device?: Array<Device['Read']>;
is_pinned_to__device?: Array<Device['Read']>;
should_operate__device?: Array<Device['Read']>;
Expand Down
3 changes: 0 additions & 3 deletions src/balena.sbvr
Original file line number Diff line number Diff line change
Expand Up @@ -578,9 +578,6 @@ Fact type: device has api secret
Fact type: device is managed by service instance
Synonymous Form: service instance manages device
Necessity: each device is managed by at most one service instance
Fact type: device should be running release
Synonymous Form: release should be running on device
Necessity: each device should be running at most one release
Fact type: device is pinned on release
Synonymous Form: release is pinned to device
Necessity: each device is pinned on at most one release
Expand Down
20 changes: 0 additions & 20 deletions src/features/devices/hooks/defaults-validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,6 @@ hooks.addPureHook('POST', 'resin', 'device', {
'Device UUID must be a 32 or 62 character long lower case hex string.',
);
}

// TODO[device management next step]: Drop this after re-migrating all data on step 2:
if (request.values.is_pinned_on__release !== undefined) {
// Add an async boundary so that value updates,
// and doesn't remove the properties that we add.
// eslint-disable-next-line @typescript-eslint/await-thenable
await null;
request.values.should_be_running__release =
request.values.is_pinned_on__release;
}
},
});

Expand Down Expand Up @@ -83,15 +73,5 @@ hooks.addPureHook('PATCH', 'resin', 'device', {
if (request.values.is_online != null) {
request.values.last_connectivity_event = new Date();
}

// TODO[device management next step]: Drop this after re-migrating all data on step 2:
if (request.values.is_pinned_on__release !== undefined) {
// Add an async boundary so that value updates,
// and doesn't remove the properties that we add.
// eslint-disable-next-line @typescript-eslint/await-thenable
await null;
request.values.should_be_running__release =
request.values.is_pinned_on__release;
}
},
});

0 comments on commit f17aead

Please sign in to comment.