Closed ericsj closed 11 months ago
Migrations are just standard ef migrations like in any .NET project. There's nothing special that craftsman does here. The message catch at the end calling out success has some holes, but if you have an error, there's probably something wrong with the build or an entity that needs to be resolved.
I don't really have anything else to go on with what you gave me though. You could share the template and your craftsman version and I can take a look when I'm able or look at resolving the migrations yourself like in any other .NET project.
Migrations are just standard ef migrations like in any .NET project. There's nothing special that craftsman does here. The message catch at the end calling out success has some holes, but if you have an error, there's probably something wrong with the build or an entity that needs to be resolved.
I don't really have anything else to go on with what you gave me though. You could share the template and your craftsman version and I can take a look when I'm able or look at resolving the migrations yourself like in any other .NET project.
Craftsman version: 0.23.2+ff50e1b35d0d3577ca947cbc7e71093583a1bff4 Dotnet version: 7.0.400 Dotnet ef version: 7.0.11 I just followed the getting started tutorial. The yaml is this:
DomainName: CarbonKitchen
BoundedContexts:
- ProjectName: RecipeManagement
Port: 5005
DbContext:
ContextName: RecipesDbContext
DatabaseName: RecipeManagement
Provider: postgres
Entities:
- Name: Recipe
Features:
- Type: AddRecord
- Type: GetRecord
- Type: GetList
- Type: UpdateRecord
- Type: DeleteRecord
Properties:
- Name: Title
Type: string
- Name: Directions
Type: string
- Name: RecipeSourceLink
Type: string
- Name: Description
Type: string
- Name: ImageLink
Type: string
- Name: Ingredient
Features:
- Type: AddRecord
- Type: GetRecord
- Type: GetList
- Type: UpdateRecord
- Type: DeleteRecord
Properties:
- Name: RecipeId
Type: int?
- Name: Name
Type: string
- Name: Unit
Type: string
- Name: Amount
Type: double?
SwaggerConfig:
Title: Carbon Kitchen Recipes
Description: Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at carbonkitchen.com/dev/docs
ApiContact:
Name: Carbon Kitchen
Email: devsupport@CarbonKitchen.com
Url: https://www.carbonkitchen.com
Gotcha thanks for the details!
I definitely let that template get a bit out of date (glad you posted), but I'm not sure why it would fail offhand either. I'll take a look
i just updated the tutorial to a working setup -- appreciate the callout on this. Full template below for easy of reference
DomainName: CarbonKitchen
BoundedContexts:
- ProjectName: RecipeManagement
Port: 5005
DbContext:
ContextName: RecipesDbContext
DatabaseName: RecipeManagement
Provider: postgres
Entities:
- Name: Recipe
Features:
- Type: AddRecord
- Type: GetRecord
- Type: GetList
- Type: UpdateRecord
- Type: DeleteRecord
Properties:
- Name: Title
Type: string
- Name: Directions
Type: string
- Name: RecipeSourceLink
Type: string
- Name: Description
Type: string
- Name: ImageLink
Type: string
- Name: Ingredients
Relationship: 1tomany
ForeignEntityName: Ingredient
ForeignEntityPlural: Ingredients
- Name: Ingredient
Features:
- Type: AddRecord
- Type: GetRecord
- Type: GetList
- Type: UpdateRecord
- Type: DeleteRecord
Properties:
- Name: Name
Type: string
- Name: Unit
Type: string
- Name: Amount
Type: double?
SwaggerConfig:
Title: Carbon Kitchen Recipes
Description: Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at carbonkitchen.com/dev/docs
ApiContact:
Name: Carbon Kitchen
Email: devsupport@CarbonKitchen.com
Url: https://www.carbonkitchen.com
When I create a domain, the migrations fail due timout (probably because the docker container has not been started yet). I tried to add a migration manually, but I'm getting "WARNING: ⚠ RecipeManagement Database Migrations timed out and will need to be run manually" When I try to add a migration using RecipeManagement.csproj as project I'm getting:
Build started... Build succeeded. An error occurred while accessing the Microsoft.Extensions.Hosting services. Continuing without the application service provider. Error: Object reference not set to an instance of an object. Unable to create an object of type 'RecipedDbContext'. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728
How to add the migration?