@@ -742,6 +742,16 @@ func TestRepoStore_PublicToUser(t *testing.T) {
742742 repo .UpdatedAt = time .Now ()
743743 rn , err := store .CreateRepo (ctx , * repo )
744744 require .Nil (t , err )
745+
746+ // Create corresponding record in codes table for CodeRepo
747+ if repo .RepositoryType == types .CodeRepo {
748+ code := database.Code {
749+ RepositoryID : rn .ID ,
750+ }
751+ _ , err = db .Core .NewInsert ().Model (& code ).Exec (ctx )
752+ require .Nil (t , err )
753+ }
754+
745755 for _ , tag := range repo .Tags {
746756 _ , err = db .Core .NewInsert ().Model (& tag ).Exec (ctx , & tag )
747757 require .Nil (t , err )
@@ -1681,6 +1691,13 @@ func TestRepoStore_PublicToUserMirror(t *testing.T) {
16811691 require .Nil (t , err )
16821692 require .NotNil (t , repo )
16831693
1694+ // Create corresponding record in datasets table for DatasetRepo
1695+ dataset := database.Dataset {
1696+ RepositoryID : repo .ID ,
1697+ }
1698+ _ , err = db .Core .NewInsert ().Model (& dataset ).Exec (ctx )
1699+ require .Nil (t , err )
1700+
16841701 userName1 := "user_name_" + uuid .NewString ()
16851702 repoName1 := "repo_name_" + uuid .NewString ()
16861703 repo1 , err := rs .CreateRepo (ctx , database.Repository {
@@ -1698,6 +1715,13 @@ func TestRepoStore_PublicToUserMirror(t *testing.T) {
16981715 require .Nil (t , err )
16991716 require .NotNil (t , repo1 )
17001717
1718+ // Create corresponding record in datasets table for DatasetRepo
1719+ dataset1 := database.Dataset {
1720+ RepositoryID : repo1 .ID ,
1721+ }
1722+ _ , err = db .Core .NewInsert ().Model (& dataset1 ).Exec (ctx )
1723+ require .Nil (t , err )
1724+
17011725 mirrorStore := database .NewMirrorStoreWithDB (db )
17021726 mirror , err := mirrorStore .Create (ctx , & database.Mirror {
17031727 RepositoryID : repo1 .ID ,
0 commit comments