mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
Fix[BE-261]: delete timestampz on expense nonstock anda expense reaalizations table
This commit is contained in:
@@ -7,10 +7,7 @@ CREATE TABLE expense_nonstocks (
|
|||||||
qty NUMERIC(15, 3) NOT NULL,
|
qty NUMERIC(15, 3) NOT NULL,
|
||||||
unit_price NUMERIC(15, 3) NOT NULL,
|
unit_price NUMERIC(15, 3) NOT NULL,
|
||||||
total_price NUMERIC(15, 3) NOT NULL,
|
total_price NUMERIC(15, 3) NOT NULL,
|
||||||
note TEXT NULL,
|
note TEXT NULL
|
||||||
created_at TIMESTAMPTZ DEFAULT now(),
|
|
||||||
updated_at TIMESTAMPTZ DEFAULT now(),
|
|
||||||
deleted_at TIMESTAMPTZ
|
|
||||||
);
|
);
|
||||||
|
|
||||||
-- Tambahkan Foreign Key ke expenses
|
-- Tambahkan Foreign Key ke expenses
|
||||||
@@ -56,6 +53,4 @@ END $$;
|
|||||||
-- Index
|
-- Index
|
||||||
CREATE INDEX idx_expense_nonstocks_expense_id ON expense_nonstocks (expense_id);
|
CREATE INDEX idx_expense_nonstocks_expense_id ON expense_nonstocks (expense_id);
|
||||||
|
|
||||||
CREATE INDEX idx_expense_nonstocks_nonstock_id ON expense_nonstocks (nonstock_id);
|
CREATE INDEX idx_expense_nonstocks_nonstock_id ON expense_nonstocks (nonstock_id);
|
||||||
|
|
||||||
CREATE INDEX idx_expense_nonstocks_deleted_at ON expense_nonstocks (deleted_at);
|
|
||||||
+2
-7
@@ -6,10 +6,7 @@ CREATE TABLE expense_realizations (
|
|||||||
realization_total_price NUMERIC(15, 3) NOT NULL,
|
realization_total_price NUMERIC(15, 3) NOT NULL,
|
||||||
realization_date DATE NOT NULL,
|
realization_date DATE NOT NULL,
|
||||||
note TEXT,
|
note TEXT,
|
||||||
created_by BIGINT,
|
created_by BIGINT
|
||||||
created_at TIMESTAMPTZ DEFAULT now(),
|
|
||||||
updated_at TIMESTAMPTZ DEFAULT now(),
|
|
||||||
deleted_at TIMESTAMPTZ
|
|
||||||
);
|
);
|
||||||
|
|
||||||
-- Tambahkan Foreign Key ke expense_nonstocks
|
-- Tambahkan Foreign Key ke expense_nonstocks
|
||||||
@@ -35,6 +32,4 @@ END $$;
|
|||||||
-- Index
|
-- Index
|
||||||
CREATE INDEX idx_expense_realizations_nonstock_id ON expense_realizations (expense_nonstock_id);
|
CREATE INDEX idx_expense_realizations_nonstock_id ON expense_realizations (expense_nonstock_id);
|
||||||
|
|
||||||
CREATE INDEX idx_expense_realizations_date ON expense_realizations (realization_date);
|
CREATE INDEX idx_expense_realizations_date ON expense_realizations (realization_date);
|
||||||
|
|
||||||
CREATE INDEX idx_expense_realizations_deleted_at ON expense_realizations (deleted_at);
|
|
||||||
@@ -1,24 +1,15 @@
|
|||||||
package entities
|
package entities
|
||||||
|
|
||||||
import (
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"gorm.io/gorm"
|
|
||||||
)
|
|
||||||
|
|
||||||
type ExpenseNonstock struct {
|
type ExpenseNonstock struct {
|
||||||
Id uint64 `gorm:"primaryKey;autoIncrement"`
|
Id uint64 `gorm:"primaryKey;autoIncrement"`
|
||||||
ExpenseId *uint64 `gorm:""`
|
ExpenseId *uint64 `gorm:""`
|
||||||
ProjectFlockKandangId *uint64 `gorm:""`
|
ProjectFlockKandangId *uint64 `gorm:""`
|
||||||
KandangId *uint64 `gorm:""`
|
KandangId *uint64 `gorm:""`
|
||||||
NonstockId *uint64 `gorm:""`
|
NonstockId *uint64 `gorm:""`
|
||||||
Qty float64 `gorm:"type:numeric(15,3);not null"`
|
Qty float64 `gorm:"type:numeric(15,3);not null"`
|
||||||
UnitPrice float64 `gorm:"type:numeric(15,3);not null"`
|
UnitPrice float64 `gorm:"type:numeric(15,3);not null"`
|
||||||
TotalPrice float64 `gorm:"type:numeric(15,3);not null"`
|
TotalPrice float64 `gorm:"type:numeric(15,3);not null"`
|
||||||
Note string `gorm:"type:text"`
|
Note string `gorm:"type:text"`
|
||||||
CreatedAt time.Time `gorm:"autoCreateTime"`
|
|
||||||
UpdatedAt time.Time `gorm:"autoUpdateTime"`
|
|
||||||
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
|
|
||||||
|
|
||||||
// Relations
|
// Relations
|
||||||
Expense *Expense `gorm:"foreignKey:ExpenseId;references:Id"`
|
Expense *Expense `gorm:"foreignKey:ExpenseId;references:Id"`
|
||||||
|
|||||||
@@ -2,22 +2,17 @@ package entities
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gorm.io/gorm"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type ExpenseRealization struct {
|
type ExpenseRealization struct {
|
||||||
Id uint64 `gorm:"primaryKey;autoIncrement"`
|
Id uint64 `gorm:"primaryKey;autoIncrement"`
|
||||||
ExpenseNonstockId *uint64 `gorm:""`
|
ExpenseNonstockId *uint64 `gorm:""`
|
||||||
RealizationQty float64 `gorm:"type:numeric(15,3);not null"`
|
RealizationQty float64 `gorm:"type:numeric(15,3);not null"`
|
||||||
RealizationUnitPrice float64 `gorm:"type:numeric(15,3);not null"`
|
RealizationUnitPrice float64 `gorm:"type:numeric(15,3);not null"`
|
||||||
RealizationTotalPrice float64 `gorm:"type:numeric(15,3);not null"`
|
RealizationTotalPrice float64 `gorm:"type:numeric(15,3);not null"`
|
||||||
RealizationDate time.Time `gorm:"type:date;not null"`
|
RealizationDate time.Time `gorm:"type:date;not null"`
|
||||||
Note *string `gorm:"type:text"`
|
Note *string `gorm:"type:text"`
|
||||||
CreatedBy *uint64 `gorm:""`
|
CreatedBy *uint64 `gorm:""`
|
||||||
CreatedAt time.Time `gorm:"autoCreateTime"`
|
|
||||||
UpdatedAt time.Time `gorm:"autoUpdateTime"`
|
|
||||||
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
|
|
||||||
|
|
||||||
// Relations
|
// Relations
|
||||||
ExpenseNonstock *ExpenseNonstock `gorm:"foreignKey:ExpenseNonstockId;references:Id"`
|
ExpenseNonstock *ExpenseNonstock `gorm:"foreignKey:ExpenseNonstockId;references:Id"`
|
||||||
|
|||||||
Reference in New Issue
Block a user