Make rating data optional

Use HTML to enfore at least one of the two fields has a value, but I don't want to require both
This commit is contained in:
mitteneer 2025-06-23 16:47:46 -04:00
parent b7e625dd98
commit 996022fe5f
4 changed files with 16 additions and 22 deletions

View file

@ -7,9 +7,9 @@ pub fn up(repo: anytype) !void {
"songratings",
&.{
t.primaryKey("id", .{}),
t.column("song", .bigint, .{ .reference = .{ "albumsongs", "id" } }),
t.column("rating", .smallint, .{}),
t.column("rating_text", .text, .{}),
t.column("song", .bigint, .{ .reference = .{ "songs", "id" } }),
t.column("rating", .smallint, .{ .optional = true }),
t.column("rating_text", .text, .{ .optional = true }),
t.column("date", .datetime, .{}),
t.timestamps(.{}),
},