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

invalid datatype #5

Open
MuhmdHsn313 opened this issue Mar 5, 2023 · 0 comments
Open

invalid datatype #5

MuhmdHsn313 opened this issue Mar 5, 2023 · 0 comments

Comments

@MuhmdHsn313
Copy link

I try to use auto-migrate for the vendor table, but there is a problem with creating it.
This is the model that I wrote:

type Vendor struct {
	ID        uint                     `json:"id" gorm:"primaryKey"`
	CreatedAt time.Time                `json:"created_at" gorm:"not null;autoCreateTime"`
	UpdatedAt time.Time                `json:"updated_at" gorm:"not null;autoUpdateTime:milli"`
	DeletedAt gorm.DeletedAt           `json:"deleted_at" gorm:"index"`
	Logo        string                 `json:"logo" gorm:"not null;type:VARCHAR2(50)"`
	Link        datatypes.URL          `json:"link"`
	IsPublished datatypes.Publishable  `json:"is_published"`
}

both datatypes.URL & datatypes.Publishable are custom gorm datatypes.

This is the DB log:

[3.119ms] [rows:0] CREATE TABLE VENDORS (ID INTEGER,CREATED_AT TIMESTAMP WITH TIME ZONE NOT NULL,UPDATED_AT TIMESTAMP WITH TIME ZONE NOT NULL,DELETED_AT TIMESTAMP WITH TIME ZONE,LOGO VARCHAR2(50) NOT NULL,LINK TEXT,IS_PUBLISHED SMALLINT,PRIMARY KEY (ID))

This is the go error:

[FTAL] 2023/03/05 13:42 ORA-00902: invalid datatype
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant