Skip to content

Commit

Permalink
upd rageywide
Browse files Browse the repository at this point in the history
  • Loading branch information
Satont committed Apr 8, 2023
1 parent 0392fcf commit fdbe0be
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions ent/migrate/migrations/atlas.sum
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
h1:TIORzPQ0gH91l3uBNc/QCex+GAAB93rfyynsMuZU0DA=
h1:+Uq126QTEe4nFfdPa9fjq+ZlDcgw5trXo/I/+9/2Tgc=
20230327181912_initial.sql h1:L6nniWh3O35p6lwgIG+NrRkkU2n2iG48Be5/zfPAz0I=
20230401125338_TitleChangeNotification.sql h1:9u5qCYBNNL6RHtLdcW691tRhYyli7/pG2kBxYuHs1fA=
20230408101010_add_stream_categories_history.sql h1:/zhrGC3To5cKmpw7ThFDDffZyrc6n22dZTBspPPG1TY=
20230408113330_add_stream_categories_history.sql h1:LeWjpeGt1nRgvVP3/mCXNeWKOuhxBhqAQEpqW9Aadwc=
5 changes: 4 additions & 1 deletion ent/schema/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package schema
import (
"entgo.io/ent"
"entgo.io/ent/dialect"
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
"github.com/google/uuid"
Expand Down Expand Up @@ -49,6 +50,8 @@ func (Stream) Edges() []ent.Edge {
Required().
Unique().
Field("channel_id"),
edge.To("stream_categories", StreamCategory.Type),
edge.To("stream_categories", StreamCategory.Type).Annotations(entsql.Annotation{
OnDelete: entsql.Cascade,
}),
}
}
2 changes: 1 addition & 1 deletion internal/db/stream_impl_ent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func TestStreamEntService_GetLatestByChannelID(t *testing.T) {
assert.Equal(t, newChannel.ID, stream.ChannelID, "Expects channel_id to be equal.")
assert.Equal(t, tt.wantedStreamID, stream.ID, "Expects stream_id to be equal.")
assert.Nil(t, stream.EndedAt, "Expects is_live to be equal.")
assert.Contains(t, stream.Categories, "Category", "Expects category to be equal.")
assert.Contains(t, stream.Categories[0].Name, "Category", "Expects category to be equal.")
assert.Contains(t, stream.Titles, "Title", "Expects title to be equal.")
}

Expand Down

0 comments on commit fdbe0be

Please sign in to comment.