El Grande Padre
El Grande Padre
Explore posts from servers
DTDrizzle Team
Created by El Grande Padre on 4/14/2025 in #help
Including SQL files in vite bundle to for migration management at runtime
Hello, I'm trying to make myself a little API endpoint to run migrations and rollbacks during runtime. I keep getting stuck on trying to include the directory with migrations in the vite build so that I can pass that directory to the migrate() function. I'm assuming theres a setting in my vite config to do this, but I keep finding links back to this page https://vite.dev/guide/assets.html which is for individual files where as I want an entire directory. Can anyone point me to what I'm looking for? Aside: I'm not using drizzle kit because I want to enable particular users with permissions to press buttons on a UI to do this eventually. That means they'll never have DB credentials or codebase access.
1 replies
CC#
Created by El Grande Padre on 9/27/2023 in #help
❔ Looking for an AutoFixture struct customization workaround
Hello, Autofixture's .Do() customization doesn't work with value types which makes sense because nothing gets returned. I'm trying to have autofixture create a start time that is guaranteed to be before an end time within a value type. The following is what I have that works for reference types but not value types. If anyone has any work arounds to make autofixture generate start times before end time I would greatly appreciate it.
struct TimeRange
{
public Instant startTime;
public Instant endTime;
}
[Theory, AutoData]
public void StartEndTime([Range(1, 100)] int cardinality)
{
var fixture = new Fixture();
var timeRanges = fixture.Build<TimeRange>()
.Without(e => e.startTime)
.Without(e => e.endTime)
.Do(e =>
{
e.startTime = fixture.Create<Instant>();
e.endTime = e.startTime + fixture.Create<Duration>();
})
.CreateMany(cardinality)
.ToList();

timeRanges.Should().AllSatisfy(e =>
{
e.startTime.Should().BeLessThan(e.endTime);
});
}
struct TimeRange
{
public Instant startTime;
public Instant endTime;
}
[Theory, AutoData]
public void StartEndTime([Range(1, 100)] int cardinality)
{
var fixture = new Fixture();
var timeRanges = fixture.Build<TimeRange>()
.Without(e => e.startTime)
.Without(e => e.endTime)
.Do(e =>
{
e.startTime = fixture.Create<Instant>();
e.endTime = e.startTime + fixture.Create<Duration>();
})
.CreateMany(cardinality)
.ToList();

timeRanges.Should().AllSatisfy(e =>
{
e.startTime.Should().BeLessThan(e.endTime);
});
}
2 replies
CC#
Created by El Grande Padre on 1/16/2023 in #help
✅ Not able to locate web api controllers in a class library
Hello, I'm having some issues with trying to load web api controllers from a class library. I did try explicitly adding the assembly with AddControllers().AddApplicationPart, but no luck there. I'm thinking it has to do with the pattern I'm using for registering services in separate assemblies.
81 replies