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

remove version column from device table #485

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
Warnings:

- You are about to drop the column `version` on the `device_inventory` table. All the data in the column will be lost.

*/
-- AlterTable
ALTER TABLE "device_inventory" DROP COLUMN "version";
1 change: 0 additions & 1 deletion prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ model device {
config Json?
model String?
deviceType String? @map("device_type")
version String? @map("version")
software String?
softwareVersion String? @map("sw_version")
macAddress String? @map("mac_address")
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/device-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export function encodeDeviceForInventoryKafka(
blueprint_id: device.blueprintId,
username: device.username,
password: device.password,
version: device.version,
version: device.softwareVersion,
// eslint-disable-next-line @typescript-eslint/naming-convention
labels_ids: deviceLabelsIds,
// eslint-disable-next-line @typescript-eslint/naming-convention
Expand Down
8 changes: 2 additions & 6 deletions src/schema/device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,6 @@ export const Device = objectType({
return root.softwareVersion;
}

if (root.version != null && root.version.length > 0) {
return root.version;
}

return null;
},
});
Expand Down Expand Up @@ -318,7 +314,7 @@ export const AddDeviceMutation = extendType({
password: input.password,
port: input.port ?? undefined,
deviceType: input.deviceType,
version: input.version,
softwareVersion: input.version,
locationId: input.locationId ? fromGraphId('Location', input.locationId) : undefined,
mountParameters: input.mountParameters != null ? JSON.parse(input.mountParameters) : undefined,
source: 'MANUAL',
Expand Down Expand Up @@ -441,7 +437,7 @@ export const UpdateDeviceMutation = extendType({
managementIp: input.address,
mountParameters: deviceMountParameters,
deviceType: input.deviceType,
version: input.version,
softwareVersion: input.version,
username: input.username,
password: input.password,
port: input.port,
Expand Down
Loading