Fix[BE-261]: delete timestampz on expense nonstock anda expense reaalizations table

This commit is contained in:
aguhh18
2025-11-21 01:06:48 +07:00
parent b8d1268dfa
commit 5a73ad0164
4 changed files with 21 additions and 45 deletions
@@ -7,10 +7,7 @@ CREATE TABLE expense_nonstocks (
qty NUMERIC(15, 3) NOT NULL,
unit_price NUMERIC(15, 3) NOT NULL,
total_price NUMERIC(15, 3) NOT NULL,
note TEXT NULL,
created_at TIMESTAMPTZ DEFAULT now(),
updated_at TIMESTAMPTZ DEFAULT now(),
deleted_at TIMESTAMPTZ
note TEXT NULL
);
-- Tambahkan Foreign Key ke expenses
@@ -57,5 +54,3 @@ END $$;
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_deleted_at ON expense_nonstocks (deleted_at);
@@ -6,10 +6,7 @@ CREATE TABLE expense_realizations (
realization_total_price NUMERIC(15, 3) NOT NULL,
realization_date DATE NOT NULL,
note TEXT,
created_by BIGINT,
created_at TIMESTAMPTZ DEFAULT now(),
updated_at TIMESTAMPTZ DEFAULT now(),
deleted_at TIMESTAMPTZ
created_by BIGINT
);
-- Tambahkan Foreign Key ke expense_nonstocks
@@ -36,5 +33,3 @@ END $$;
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_deleted_at ON expense_realizations (deleted_at);
-9
View File
@@ -1,11 +1,5 @@
package entities
import (
"time"
"gorm.io/gorm"
)
type ExpenseNonstock struct {
Id uint64 `gorm:"primaryKey;autoIncrement"`
ExpenseId *uint64 `gorm:""`
@@ -16,9 +10,6 @@ type ExpenseNonstock struct {
UnitPrice float64 `gorm:"type:numeric(15,3);not null"`
TotalPrice float64 `gorm:"type:numeric(15,3);not null"`
Note string `gorm:"type:text"`
CreatedAt time.Time `gorm:"autoCreateTime"`
UpdatedAt time.Time `gorm:"autoUpdateTime"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
// Relations
Expense *Expense `gorm:"foreignKey:ExpenseId;references:Id"`
-5
View File
@@ -2,8 +2,6 @@ package entities
import (
"time"
"gorm.io/gorm"
)
type ExpenseRealization struct {
@@ -15,9 +13,6 @@ type ExpenseRealization struct {
RealizationDate time.Time `gorm:"type:date;not null"`
Note *string `gorm:"type:text"`
CreatedBy *uint64 `gorm:""`
CreatedAt time.Time `gorm:"autoCreateTime"`
UpdatedAt time.Time `gorm:"autoUpdateTime"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
// Relations
ExpenseNonstock *ExpenseNonstock `gorm:"foreignKey:ExpenseNonstockId;references:Id"`