diff --git a/Parlance.Database/Models/EditsPending.cs b/Parlance.Database/Models/EditsPending.cs index 3042f2df..2a76bf98 100644 --- a/Parlance.Database/Models/EditsPending.cs +++ b/Parlance.Database/Models/EditsPending.cs @@ -13,6 +13,7 @@ public class EditsPending public ulong UserId { get; set; } public string Project { get; set; } = null!; + public string Branch { get; set; } = null!; public string Subproject { get; set; } = null!; public string Language { get; set; } = null!; } \ No newline at end of file diff --git a/Parlance.Database/Models/IndexItem.cs b/Parlance.Database/Models/IndexItem.cs index d348d327..3c06691d 100644 --- a/Parlance.Database/Models/IndexItem.cs +++ b/Parlance.Database/Models/IndexItem.cs @@ -21,6 +21,7 @@ public class IndexItem public Guid Id { get; set; } public string Project { get; set; } = null!; + public string Branch { get; set; } = null!; public string Subproject { get; set; } = null!; public string Language { get; set; } = null!; public string ItemIdentifier { get; set; } = null!; diff --git a/Parlance.Database/Models/ProjectBranch.cs b/Parlance.Database/Models/ProjectBranch.cs new file mode 100644 index 00000000..f7568dd0 --- /dev/null +++ b/Parlance.Database/Models/ProjectBranch.cs @@ -0,0 +1,20 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace Parlance.Database.Models; + +public class ProjectBranch +{ + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] + [Key] + public Guid Id { get; set; } + + public Guid? ProjectId { get; set; } + public Project? Project { get; set; } + + public string BranchName { get; set; } + + public string Worktree { get; set; } + + public bool DefaultBranch { get; set; } +} \ No newline at end of file diff --git a/Parlance.Database/Models/SourceStrings.cs b/Parlance.Database/Models/SourceStrings.cs index 4da80908..aef46e13 100644 --- a/Parlance.Database/Models/SourceStrings.cs +++ b/Parlance.Database/Models/SourceStrings.cs @@ -10,6 +10,7 @@ public class SourceStrings public Guid Id { get; set; } public string Project { get; set; } + public string Branch { get; set; } public string Subproject { get; set; } public string Language { get; set; } public string Key { get; set; } diff --git a/Parlance.Database/ParlanceContext.cs b/Parlance.Database/ParlanceContext.cs index 72200ba3..08718392 100644 --- a/Parlance.Database/ParlanceContext.cs +++ b/Parlance.Database/ParlanceContext.cs @@ -9,6 +9,7 @@ public class ParlanceContext(DbContextOptions options) : DbContext(options) public DbSet SshTrustedServers { get; set; } = null!; public DbSet Superusers { get; set; } = null!; public DbSet Projects { get; set; } = null!; + public DbSet ProjectBranches { get; set; } = null!; public DbSet Permissions { get; set; } = null!; public DbSet Index { get; set; } = null!; public DbSet Alerts { get; set; } = null!; @@ -32,6 +33,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) modelBuilder.Entity().ToTable("Superusers"); modelBuilder.Entity().ToTable("Projects") .HasIndex(p => p.Name).IsUnique(); + modelBuilder.Entity().ToTable("ProjectBranches"); modelBuilder.Entity().ToTable("Permissions"); modelBuilder.Entity().ToTable("Index"); modelBuilder.Entity().ToTable("Alerts"); diff --git a/Parlance.Project/ParlanceProject.cs b/Parlance.Project/ParlanceProject.cs index 05e8fa4b..9ddcd395 100644 --- a/Parlance.Project/ParlanceProject.cs +++ b/Parlance.Project/ParlanceProject.cs @@ -14,7 +14,7 @@ public class ParlanceProject : IParlanceProject private readonly Database.Models.Project _project; - public ParlanceProject(Database.Models.Project project) + public ParlanceProject(Database.Models.Project project, string branch) { _project = project; using var file = File.OpenRead(Path.Combine(project.VcsDirectory, ".parlance.json"));