Skip to content

Commit

Permalink
Update Migration1000.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
mythz committed Apr 1, 2024
1 parent b7aa7f6 commit a01358a
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions MyApp/Migrations/Migration1000.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,30 +28,6 @@ public class Vote
public int Score { get; set; }
}

public class StatTotals
{
// PostId (Question) or PostId-UserName (Answer)
public required string Id { get; set; }

[Index] public int PostId { get; set; }

[Index] public string? CreatedBy { get; set; }

public int FavoriteCount { get; set; }

// post.ViewCount + Sum(PostView.PostId)
public int ViewCount { get; set; }

// Sum(Vote(PostId).Score > 0)
public int UpVotes { get; set; }

// Sum(Vote(PostId).Score < 0)
public int DownVotes { get; set; }

// post.Score || Meta.ModelVotes[PostId] (Model Ranking Score)
public int StartingUpVotes { get; set; }
}

public class Job
{
[AutoIncrement]
Expand Down Expand Up @@ -154,22 +130,16 @@ public override void Up()
Db.CreateTable<UserInfo>();
Db.CreateTable<Vote>();
Db.CreateTable<Job>();
// Db.CreateTable<StatTotals>();
Db.CreateTable<PostJob>();

Db.ExecuteSql("INSERT INTO UserInfo (UserId, UserName) SELECT Id, UserName FROM AspNetUsers");
Db.ExecuteSql("ALTER TABLE StatTotals ADD COLUMN CreatedBy TEXT NULL");
Db.ExecuteSql("CREATE INDEX idx_createdby ON StatTotals (CreatedBy)");
}

public override void Down()
{
Db.DeleteAll<UserInfo>();
Db.ExecuteSql("ALTER TABLE StatTotals DROP COLUMN CreatedBy");
Db.ExecuteSql("DROP INDEX IF EXISTS StatTotals.idx_createdby");

Db.DropTable<PostJob>();
// Db.DropTable<StatTotals>();
Db.DropTable<Job>();
Db.DropTable<Vote>();
Db.DropTable<UserInfo>();
Expand Down

0 comments on commit a01358a

Please sign in to comment.