From a1751b891889be904845a16792820b7c122b4c22 Mon Sep 17 00:00:00 2001 From: "gowthaman.b" Date: Sun, 28 Apr 2024 19:06:22 +0530 Subject: [PATCH] change product id type --- src/main/kotlin/com/restapi/controllers/Excel.kt | 2 +- src/main/kotlin/com/restapi/domain/models.kt | 2 +- src/main/resources/dbmigration/1.24.sql | 2 ++ src/main/resources/dbmigration/model/1.24.model.xml | 6 ++++++ 4 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 src/main/resources/dbmigration/1.24.sql create mode 100644 src/main/resources/dbmigration/model/1.24.model.xml diff --git a/src/main/kotlin/com/restapi/controllers/Excel.kt b/src/main/kotlin/com/restapi/controllers/Excel.kt index 256a216..4f65feb 100644 --- a/src/main/kotlin/com/restapi/controllers/Excel.kt +++ b/src/main/kotlin/com/restapi/controllers/Excel.kt @@ -629,7 +629,7 @@ fun ImportFromExcel(fileType: FileType, filePath: String) { sh.rowIterator().forEach { row -> if (row == null) return@forEach //id, name, description, hsnCode, uom - val prodId = longIntFromCellHelper(row.getCell(0)) + val prodId = stringFromCellHelper(row.getCell(0)) val prodName = stringFromCellHelper(row.getCell(1)) val prodDesc = stringFromCellHelper(row.getCell(2)) val prodHsnCode = stringFromCellHelper(row.getCell(3)) diff --git a/src/main/kotlin/com/restapi/domain/models.kt b/src/main/kotlin/com/restapi/domain/models.kt index 3788545..2912aaf 100644 --- a/src/main/kotlin/com/restapi/domain/models.kt +++ b/src/main/kotlin/com/restapi/domain/models.kt @@ -318,7 +318,7 @@ open class Product : BaseTenantModel() { this.uom = updatedProduct.uom } - var id: Long? = null + var id: String? = null var name: String = "" var description: String = "" var hsnCode: String = "" diff --git a/src/main/resources/dbmigration/1.24.sql b/src/main/resources/dbmigration/1.24.sql new file mode 100644 index 0000000..971eb45 --- /dev/null +++ b/src/main/resources/dbmigration/1.24.sql @@ -0,0 +1,2 @@ +-- apply alter tables +alter table product alter column id type varchar(255) using id::varchar(255); diff --git a/src/main/resources/dbmigration/model/1.24.model.xml b/src/main/resources/dbmigration/model/1.24.model.xml new file mode 100644 index 0000000..1c9330d --- /dev/null +++ b/src/main/resources/dbmigration/model/1.24.model.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file