Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repro for possible bug in Primary key order #154

Merged
merged 2 commits into from
Jan 8, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 56 additions & 18 deletions BTDB.SourceGenerator.Test/RelationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -250,28 +250,66 @@ public Task ComplexSkymambaExample()
{
// language=cs
return VerifySourceGenerator("""
using System.Collections.Generic;
using BTDB.ODBLayer;
using System.Collections.Generic;
using BTDB.ODBLayer;

public class ContinentMigrationInfo
{
[PrimaryKey(1)]
public ulong CompanyId { get; set; }
}
public class ContinentMigrationInfo
{
[PrimaryKey(1)]
public ulong CompanyId { get; set; }
}

public interface ICompanyTableBase<T> : ICovariantCompanyTableBase<T>, IRelation<T>
where T : class
{
}
public interface ICompanyTableBase<T> : ICovariantCompanyTableBase<T>, IRelation<T>
where T : class
{
}

public interface ICovariantCompanyTableBase<out T> : ICovariantRelation<T> where T : class
{
}
public interface ICovariantCompanyTableBase<out T> : ICovariantRelation<T> where T : class
{
}

public interface IPeripheryMigrationInfoTable : ICompanyTableBase<ContinentMigrationInfo>
{
}
public interface IPeripheryMigrationInfoTable : ICompanyTableBase<ContinentMigrationInfo>
{
}

""");
""");
}

[Fact]
public Task ComplexSkymambaExample_OrderError()
{
// language=cs
return VerifySourceGenerator("""
using System.Collections.Generic;
using BTDB.ODBLayer;

public class Item : ICompanyRecord
{
[PrimaryKey(1)]
public ulong CompanyId { get; set; }

[PrimaryKey(2)]
public string Queue { get; set; }

[PrimaryKey(3)]
public Guid ItemId { get; set; }

[SecondaryKey(nameof(LockDeadline), IncludePrimaryKeyOrder = 2, Order = 3)]
public int Priority { get; set; }

/// <summary>
/// The deadline by which the worker should renew lock or complete the work;
/// after deadline work item is available to other worker.
/// </summary>
[SecondaryKey(nameof(LockDeadline), Order = 4)]
public DateTime LockDeadline { get; set; }
}


public interface IItemTable : IRelation<Item>
{
}

""");
}
}
Loading