unit,unit-position,installation-position ids into codes

This commit is contained in:
dpurbosakti
2025-11-06 15:32:05 +07:00
parent b597b76092
commit 42b1b48e36
5 changed files with 25 additions and 15 deletions
@@ -0,0 +1,6 @@
-- Modify "InstallationPosition" table
ALTER TABLE "public"."InstallationPosition" ADD COLUMN "Installation_Code" character varying(10) NULL;
-- Modify "Unit" table
ALTER TABLE "public"."Unit" ADD COLUMN "Installation_Code" character varying(10) NULL;
-- Modify "UnitPosition" table
ALTER TABLE "public"."UnitPosition" ADD COLUMN "Unit_Code" character varying(10) NULL;
+2 -1
View File
@@ -1,4 +1,4 @@
h1:gZkp4dTWkJKTmsiLhz5DI6QMvJuBGfurq4lkNKPThjU=
h1:w/qs7zN2FLnTjsmLVrFnMQWMxp3LYDJa0RLY74HVK0g=
20250904105930.sql h1:MEM6blCgke9DzWQSTnLzasbPIrcHssNNrJqZpSkEo6k=
20250904141448.sql h1:J8cmYNk4ZrG9fhfbi2Z1IWz7YkfvhFqTzrLFo58BPY0=
20250908062237.sql h1:Pu23yEW/aKkwozHoOuROvHS/GK4ngARJGdO7FB7HZuI=
@@ -81,3 +81,4 @@ h1:gZkp4dTWkJKTmsiLhz5DI6QMvJuBGfurq4lkNKPThjU=
20251106073157.sql h1:78txeibJ602DMD7huD618ZSMt6phSRzDNPTlo0PGyrc=
20251106074218.sql h1:8Xz7WywrtUnSxOHhlal53gG9rE7r86LFUt5zBFe/mIs=
20251106081846.sql h1:jp91Bf5bxGXMiUB1VIuN6y768vb2iWwow44WfCE5J5k=
20251106082844.sql h1:RHYzRO4G1fSWwf+xc/3QezZ/Iil67cZPIgNpNz3TNhQ=
@@ -6,13 +6,14 @@ import (
)
type Basic struct {
ecore.SmallMain // adjust this according to the needs
Installation_Id *uint16 `json:"installation_id" gorm:"not null"`
Code string `json:"code" gorm:"unique;size:10;not null"`
Name string `json:"name" gorm:"size:30;not null"`
HeadStatus bool `json:"headStatus"`
Employee_Id *uint `json:"employee_id"`
Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"`
ecore.SmallMain // adjust this according to the needs
Installation_Id *uint16 `json:"installation_id" gorm:"not null"`
Installation_Code *string `json:"installation_code" gorm:"size:10"`
Code string `json:"code" gorm:"unique;size:10;not null"`
Name string `json:"name" gorm:"size:30;not null"`
HeadStatus bool `json:"headStatus"`
Employee_Id *uint `json:"employee_id"`
Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"`
}
func (Basic) TableName() string {
@@ -8,6 +8,7 @@ import (
type Basic struct {
ecore.SmallMain // adjust this according to the needs
Unit_Id *uint16 `json:"unit_id" gorm:"not null"`
Unit_Code *string `json:"unit_code" gorm:"size:10"`
Code string `json:"code" gorm:"unique;size:10;not null"`
Name string `json:"name" gorm:"size:30;not null"`
HeadStatus bool `json:"headStatus"`
+8 -7
View File
@@ -8,11 +8,12 @@ import (
)
type Unit struct {
ecore.SmallMain // adjust this according to the needs
Installation_Id *uint16 `json:"installation_id"`
Installation *ei.Installation `json:"installation" gorm:"foreignKey:Installation_Id"`
Code string `json:"code" gorm:"unique;size:10"`
Name string `json:"name" gorm:"size:50"`
Type_Code *ero.UnitTypeCode `json:"type_code"`
UnitPositions []eub.Basic `json:"unitPositions,omitempty" gorm:"foreignKey:Unit_Id;references:Id"`
ecore.SmallMain // adjust this according to the needs
Installation_Id *uint16 `json:"installation_id"`
Installation_Code *string `json:"installation_code" gorm:"size:10"`
Installation *ei.Installation `json:"installation" gorm:"foreignKey:Installation_Id"`
Code string `json:"code" gorm:"unique;size:10"`
Name string `json:"name" gorm:"size:50"`
Type_Code *ero.UnitTypeCode `json:"type_code"`
UnitPositions []eub.Basic `json:"unitPositions,omitempty" gorm:"foreignKey:Unit_Id;references:Id"`
}