Skip to content

Commit 8c7ebf3

Browse files
chore(examples): remove NOT NULL non-PrimaryKey columns from basic/gorm
1 parent bdb3e08 commit 8c7ebf3

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

examples/basic/gorm/models.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ import (
99

1010
type Series struct {
1111
ID string `gorm:"column:series_id;primarykey;not null"`
12-
Title string `gorm:"column:title;not null"`
12+
Title string `gorm:"column:title"`
1313
Info string `gorm:"column:series_info"`
1414
Comment string `gorm:"column:comment"`
15-
ReleaseDate time.Time `gorm:"column:release_date;not null"`
15+
ReleaseDate time.Time `gorm:"column:release_date"`
1616

1717
Seasons []Season
1818
}
@@ -30,11 +30,11 @@ func (s *Series) BeforeCreate(_ *gorm.DB) (err error) {
3030
}
3131

3232
type Season struct {
33-
ID string `gorm:"column:season_id;primarykey"`
33+
ID string `gorm:"column:season_id;primarykey;not null"`
3434
SeriesID string `gorm:"column:series_id;index"`
35-
Title string `gorm:"column:title;not null"`
36-
FirstAired time.Time `gorm:"column:first_aired;not null"`
37-
LastAired time.Time `gorm:"column:last_aired;not null"`
35+
Title string `gorm:"column:title"`
36+
FirstAired time.Time `gorm:"column:first_aired"`
37+
LastAired time.Time `gorm:"column:last_aired"`
3838

3939
Episodes []Episode
4040
}
@@ -52,10 +52,10 @@ func (s *Season) BeforeCreate(_ *gorm.DB) (err error) {
5252
}
5353

5454
type Episode struct {
55-
ID string `gorm:"column:episode_id;primarykey"`
56-
SeasonID string `gorm:"column:season_id;index;not null"`
57-
Title string `gorm:"column:title;not null"`
58-
AirDate time.Time `gorm:"column:air_date;not null"`
55+
ID string `gorm:"column:episode_id;primarykey;not null"`
56+
SeasonID string `gorm:"column:season_id;index"`
57+
Title string `gorm:"column:title"`
58+
AirDate time.Time `gorm:"column:air_date"`
5959
}
6060

6161
func (e *Episode) BeforeCreate(_ *gorm.DB) (err error) {

0 commit comments

Comments
 (0)