From 5e54167009dc6504c5fb4210728499d7a2f84ab7 Mon Sep 17 00:00:00 2001 From: Hein Date: Thu, 30 Apr 2026 20:31:34 +0200 Subject: [PATCH] fix(db): update SQL default values and types for consistency * Corrected default values for various fields in SQL schema * Changed tags field type from text[] to text[] with proper default * Updated JSONB default values to remove unnecessary quotes --- go.mod | 2 +- go.sum | 2 + internal/app/resolvespec_admin.go | 5 ++ .../sql_public_agent_guardrails.go | 20 +++---- .../sql_public_agent_skills.go | 20 +++---- .../generatedmodels/sql_public_embeddings.go | 2 +- .../generatedmodels/sql_public_learnings.go | 52 ++++++++--------- internal/generatedmodels/sql_public_plans.go | 46 +++++++-------- .../sql_public_professional_contacts.go | 2 +- .../generatedmodels/sql_public_recipes.go | 28 ++++----- .../generatedmodels/sql_public_thoughts.go | 2 +- migrations/020_generated_schema.sql | 58 +++++++++---------- 12 files changed, 123 insertions(+), 116 deletions(-) diff --git a/go.mod b/go.mod index 4c04073..eef6880 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module git.warky.dev/wdevs/amcs go 1.26.1 require ( - github.com/bitechdev/ResolveSpec v1.0.86 + github.com/bitechdev/ResolveSpec v1.0.87 github.com/google/jsonschema-go v0.4.2 github.com/google/uuid v1.6.0 github.com/jackc/pgx/v5 v5.9.1 diff --git a/go.sum b/go.sum index 60aba7c..d356a0e 100644 --- a/go.sum +++ b/go.sum @@ -36,6 +36,8 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bitechdev/ResolveSpec v1.0.86 h1:a4yFMMDizrmvDOV61cj/+kD+mEtKL/5EIHY2GcP3uJU= github.com/bitechdev/ResolveSpec v1.0.86/go.mod h1:YZOY2YCD0Kmb+pjAMhOqPh4q82Hij57F/CLlCMkzT78= +github.com/bitechdev/ResolveSpec v1.0.87 h1:zLiHynLK8LLpXIfCZOjL5Iy1COBS6YZcWE1BHKfYqbA= +github.com/bitechdev/ResolveSpec v1.0.87/go.mod h1:YZOY2YCD0Kmb+pjAMhOqPh4q82Hij57F/CLlCMkzT78= github.com/bradfitz/gomemcache v0.0.0-20250403215159-8d39553ac7cf h1:TqhNAT4zKbTdLa62d2HDBFdvgSbIGB3eJE8HqhgiL9I= github.com/bradfitz/gomemcache v0.0.0-20250403215159-8d39553ac7cf/go.mod h1:r5xuitiExdLAJ09PR7vBVENGvp4ZuTBeWTGtxuX3K+c= github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs= diff --git a/internal/app/resolvespec_admin.go b/internal/app/resolvespec_admin.go index 0a5b796..0ac7c50 100644 --- a/internal/app/resolvespec_admin.go +++ b/internal/app/resolvespec_admin.go @@ -114,6 +114,11 @@ func resolveSpecModels() []resolveSpecModel { {schema: "public", entity: "maintenance_tasks", model: generatedmodels.ModelPublicMaintenanceTasks{}}, {schema: "public", entity: "meal_plans", model: generatedmodels.ModelPublicMealPlans{}}, {schema: "public", entity: "opportunities", model: generatedmodels.ModelPublicOpportunities{}}, + {schema: "public", entity: "plan_dependencies", model: generatedmodels.ModelPublicPlanDependencies{}}, + {schema: "public", entity: "plan_guardrails", model: generatedmodels.ModelPublicPlanGuardrails{}}, + {schema: "public", entity: "plan_related_plans", model: generatedmodels.ModelPublicPlanRelatedPlans{}}, + {schema: "public", entity: "plan_skills", model: generatedmodels.ModelPublicPlanSkills{}}, + {schema: "public", entity: "plans", model: generatedmodels.ModelPublicPlans{}}, {schema: "public", entity: "professional_contacts", model: generatedmodels.ModelPublicProfessionalContacts{}}, {schema: "public", entity: "project_guardrails", model: generatedmodels.ModelPublicProjectGuardrails{}}, {schema: "public", entity: "project_skills", model: generatedmodels.ModelPublicProjectSkills{}}, diff --git a/internal/generatedmodels/sql_public_agent_guardrails.go b/internal/generatedmodels/sql_public_agent_guardrails.go index c8d83dc..63fb3ce 100644 --- a/internal/generatedmodels/sql_public_agent_guardrails.go +++ b/internal/generatedmodels/sql_public_agent_guardrails.go @@ -9,16 +9,16 @@ import ( type ModelPublicAgentGuardrails struct { bun.BaseModel `bun:"table:public.agent_guardrails,alias:agent_guardrails"` - ID resolvespec_common.SqlUUID `bun:"id,type:uuid,pk,default:gen_random_uuid()," json:"id"` - Content resolvespec_common.SqlString `bun:"content,type:text,notnull," json:"content"` - CreatedAt resolvespec_common.SqlTimeStamp `bun:"created_at,type:timestamptz,default:now(),notnull," json:"created_at"` - Description resolvespec_common.SqlString `bun:"description,type:text,default:'',notnull," json:"description"` - Name resolvespec_common.SqlString `bun:"name,type:text,notnull," json:"name"` - Severity resolvespec_common.SqlString `bun:"severity,type:text,default:'medium',notnull," json:"severity"` - Tags resolvespec_common.SqlString `bun:"tags,type:text,default:'{}',notnull," json:"tags"` - UpdatedAt resolvespec_common.SqlTimeStamp `bun:"updated_at,type:timestamptz,default:now(),notnull," json:"updated_at"` - RelGuardrailIDPublicPlanGuardrails []*ModelPublicPlanGuardrails `bun:"rel:has-many,join:id=guardrail_id" json:"relguardrailidpublicplanguardrails,omitempty"` // Has many ModelPublicPlanGuardrails - RelGuardrailIDPublicProjectGuardrails []*ModelPublicProjectGuardrails `bun:"rel:has-many,join:id=guardrail_id" json:"relguardrailidpublicprojectguardrails,omitempty"` // Has many ModelPublicProjectGuardrails + ID resolvespec_common.SqlUUID `bun:"id,type:uuid,pk,default:gen_random_uuid()," json:"id"` + Content resolvespec_common.SqlString `bun:"content,type:text,notnull," json:"content"` + CreatedAt resolvespec_common.SqlTimeStamp `bun:"created_at,type:timestamptz,default:now(),notnull," json:"created_at"` + Description resolvespec_common.SqlString `bun:"description,type:text,default:'',notnull," json:"description"` + Name resolvespec_common.SqlString `bun:"name,type:text,notnull," json:"name"` + Severity resolvespec_common.SqlString `bun:"severity,type:text,default:'medium',notnull," json:"severity"` + Tags resolvespec_common.SqlStringArray `bun:"tags,type:text,default:'{}',notnull," json:"tags"` + UpdatedAt resolvespec_common.SqlTimeStamp `bun:"updated_at,type:timestamptz,default:now(),notnull," json:"updated_at"` + RelGuardrailIDPublicPlanGuardrails []*ModelPublicPlanGuardrails `bun:"rel:has-many,join:id=guardrail_id" json:"relguardrailidpublicplanguardrails,omitempty"` // Has many ModelPublicPlanGuardrails + RelGuardrailIDPublicProjectGuardrails []*ModelPublicProjectGuardrails `bun:"rel:has-many,join:id=guardrail_id" json:"relguardrailidpublicprojectguardrails,omitempty"` // Has many ModelPublicProjectGuardrails } // TableName returns the table name for ModelPublicAgentGuardrails diff --git a/internal/generatedmodels/sql_public_agent_skills.go b/internal/generatedmodels/sql_public_agent_skills.go index 2342855..87b15eb 100644 --- a/internal/generatedmodels/sql_public_agent_skills.go +++ b/internal/generatedmodels/sql_public_agent_skills.go @@ -9,16 +9,16 @@ import ( type ModelPublicAgentSkills struct { bun.BaseModel `bun:"table:public.agent_skills,alias:agent_skills"` - ID resolvespec_common.SqlUUID `bun:"id,type:uuid,pk,default:gen_random_uuid()," json:"id"` - Content resolvespec_common.SqlString `bun:"content,type:text,notnull," json:"content"` - CreatedAt resolvespec_common.SqlTimeStamp `bun:"created_at,type:timestamptz,default:now(),notnull," json:"created_at"` - Description resolvespec_common.SqlString `bun:"description,type:text,default:'',notnull," json:"description"` - Name resolvespec_common.SqlString `bun:"name,type:text,notnull," json:"name"` - Tags resolvespec_common.SqlString `bun:"tags,type:text,default:'{}',notnull," json:"tags"` - UpdatedAt resolvespec_common.SqlTimeStamp `bun:"updated_at,type:timestamptz,default:now(),notnull," json:"updated_at"` - RelRelatedSkillIDPublicLearnings []*ModelPublicLearnings `bun:"rel:has-many,join:id=related_skill_id" json:"relrelatedskillidpubliclearnings,omitempty"` // Has many ModelPublicLearnings - RelSkillIDPublicPlanSkills []*ModelPublicPlanSkills `bun:"rel:has-many,join:id=skill_id" json:"relskillidpublicplanskills,omitempty"` // Has many ModelPublicPlanSkills - RelSkillIDPublicProjectSkills []*ModelPublicProjectSkills `bun:"rel:has-many,join:id=skill_id" json:"relskillidpublicprojectskills,omitempty"` // Has many ModelPublicProjectSkills + ID resolvespec_common.SqlUUID `bun:"id,type:uuid,pk,default:gen_random_uuid()," json:"id"` + Content resolvespec_common.SqlString `bun:"content,type:text,notnull," json:"content"` + CreatedAt resolvespec_common.SqlTimeStamp `bun:"created_at,type:timestamptz,default:now(),notnull," json:"created_at"` + Description resolvespec_common.SqlString `bun:"description,type:text,default:'',notnull," json:"description"` + Name resolvespec_common.SqlString `bun:"name,type:text,notnull," json:"name"` + Tags resolvespec_common.SqlStringArray `bun:"tags,type:text,default:'{}',notnull," json:"tags"` + UpdatedAt resolvespec_common.SqlTimeStamp `bun:"updated_at,type:timestamptz,default:now(),notnull," json:"updated_at"` + RelRelatedSkillIDPublicLearnings []*ModelPublicLearnings `bun:"rel:has-many,join:id=related_skill_id" json:"relrelatedskillidpubliclearnings,omitempty"` // Has many ModelPublicLearnings + RelSkillIDPublicPlanSkills []*ModelPublicPlanSkills `bun:"rel:has-many,join:id=skill_id" json:"relskillidpublicplanskills,omitempty"` // Has many ModelPublicPlanSkills + RelSkillIDPublicProjectSkills []*ModelPublicProjectSkills `bun:"rel:has-many,join:id=skill_id" json:"relskillidpublicprojectskills,omitempty"` // Has many ModelPublicProjectSkills } // TableName returns the table name for ModelPublicAgentSkills diff --git a/internal/generatedmodels/sql_public_embeddings.go b/internal/generatedmodels/sql_public_embeddings.go index c69780e..16c26f7 100644 --- a/internal/generatedmodels/sql_public_embeddings.go +++ b/internal/generatedmodels/sql_public_embeddings.go @@ -12,7 +12,7 @@ type ModelPublicEmbeddings struct { ID resolvespec_common.SqlInt64 `bun:"id,type:bigserial,pk,autoincrement," json:"id"` CreatedAt resolvespec_common.SqlTimeStamp `bun:"created_at,type:timestamptz,default:now(),nullzero," json:"created_at"` Dim int32 `bun:"dim,type:int,notnull," json:"dim"` - Embedding resolvespec_common.SqlString `bun:"embedding,type:vector,notnull," json:"embedding"` + Embedding resolvespec_common.SqlVector `bun:"embedding,type:vector,notnull," json:"embedding"` GUID resolvespec_common.SqlUUID `bun:"guid,type:uuid,default:gen_random_uuid(),notnull," json:"guid"` Model resolvespec_common.SqlString `bun:"model,type:text,notnull,unique:uidx_embeddings_thought_id_model," json:"model"` ThoughtID resolvespec_common.SqlUUID `bun:"thought_id,type:uuid,notnull,unique:uidx_embeddings_thought_id_model," json:"thought_id"` diff --git a/internal/generatedmodels/sql_public_learnings.go b/internal/generatedmodels/sql_public_learnings.go index eac1446..5bc176f 100644 --- a/internal/generatedmodels/sql_public_learnings.go +++ b/internal/generatedmodels/sql_public_learnings.go @@ -9,32 +9,32 @@ import ( type ModelPublicLearnings struct { bun.BaseModel `bun:"table:public.learnings,alias:learnings"` - ID resolvespec_common.SqlUUID `bun:"id,type:uuid,pk,default:gen_random_uuid()," json:"id"` - ActionRequired bool `bun:"action_required,type:boolean,default:false,notnull," json:"action_required"` - Area resolvespec_common.SqlString `bun:"area,type:text,default:'other',notnull," json:"area"` - Category resolvespec_common.SqlString `bun:"category,type:text,default:'insight',notnull," json:"category"` - Confidence resolvespec_common.SqlString `bun:"confidence,type:text,default:'hypothesis',notnull," json:"confidence"` - CreatedAt resolvespec_common.SqlTimeStamp `bun:"created_at,type:timestamptz,default:now(),notnull," json:"created_at"` - Details resolvespec_common.SqlString `bun:"details,type:text,default:'',notnull," json:"details"` - DuplicateOfLearningID resolvespec_common.SqlUUID `bun:"duplicate_of_learning_id,type:uuid,nullzero," json:"duplicate_of_learning_id"` - Priority resolvespec_common.SqlString `bun:"priority,type:text,default:'medium',notnull," json:"priority"` - ProjectID resolvespec_common.SqlUUID `bun:"project_id,type:uuid,nullzero," json:"project_id"` - RelatedSkillID resolvespec_common.SqlUUID `bun:"related_skill_id,type:uuid,nullzero," json:"related_skill_id"` - RelatedThoughtID resolvespec_common.SqlUUID `bun:"related_thought_id,type:uuid,nullzero," json:"related_thought_id"` - ReviewedAt resolvespec_common.SqlTimeStamp `bun:"reviewed_at,type:timestamptz,nullzero," json:"reviewed_at"` - ReviewedBy resolvespec_common.SqlString `bun:"reviewed_by,type:text,nullzero," json:"reviewed_by"` - SourceRef resolvespec_common.SqlString `bun:"source_ref,type:text,nullzero," json:"source_ref"` - SourceType resolvespec_common.SqlString `bun:"source_type,type:text,nullzero," json:"source_type"` - Status resolvespec_common.SqlString `bun:"status,type:text,default:'pending',notnull," json:"status"` - Summary resolvespec_common.SqlString `bun:"summary,type:text,notnull," json:"summary"` - SupersedesLearningID resolvespec_common.SqlUUID `bun:"supersedes_learning_id,type:uuid,nullzero," json:"supersedes_learning_id"` - Tags resolvespec_common.SqlString `bun:"tags,type:text,default:'{}',notnull," json:"tags"` - UpdatedAt resolvespec_common.SqlTimeStamp `bun:"updated_at,type:timestamptz,default:now(),notnull," json:"updated_at"` - RelDuplicateOfLearningID *ModelPublicLearnings `bun:"rel:has-one,join:duplicate_of_learning_id=id" json:"relduplicateoflearningid,omitempty"` // Has one ModelPublicLearnings - RelProjectID *ModelPublicProjects `bun:"rel:has-one,join:project_id=guid" json:"relprojectid,omitempty"` // Has one ModelPublicProjects - RelRelatedSkillID *ModelPublicAgentSkills `bun:"rel:has-one,join:related_skill_id=id" json:"relrelatedskillid,omitempty"` // Has one ModelPublicAgentSkills - RelRelatedThoughtID *ModelPublicThoughts `bun:"rel:has-one,join:related_thought_id=guid" json:"relrelatedthoughtid,omitempty"` // Has one ModelPublicThoughts - RelSupersedesLearningID *ModelPublicLearnings `bun:"rel:has-one,join:supersedes_learning_id=id" json:"relsupersedeslearningid,omitempty"` // Has one ModelPublicLearnings + ID resolvespec_common.SqlUUID `bun:"id,type:uuid,pk,default:gen_random_uuid()," json:"id"` + ActionRequired bool `bun:"action_required,type:boolean,default:false,notnull," json:"action_required"` + Area resolvespec_common.SqlString `bun:"area,type:text,default:'other',notnull," json:"area"` + Category resolvespec_common.SqlString `bun:"category,type:text,default:'insight',notnull," json:"category"` + Confidence resolvespec_common.SqlString `bun:"confidence,type:text,default:'hypothesis',notnull," json:"confidence"` + CreatedAt resolvespec_common.SqlTimeStamp `bun:"created_at,type:timestamptz,default:now(),notnull," json:"created_at"` + Details resolvespec_common.SqlString `bun:"details,type:text,default:'',notnull," json:"details"` + DuplicateOfLearningID resolvespec_common.SqlUUID `bun:"duplicate_of_learning_id,type:uuid,nullzero," json:"duplicate_of_learning_id"` + Priority resolvespec_common.SqlString `bun:"priority,type:text,default:'medium',notnull," json:"priority"` + ProjectID resolvespec_common.SqlUUID `bun:"project_id,type:uuid,nullzero," json:"project_id"` + RelatedSkillID resolvespec_common.SqlUUID `bun:"related_skill_id,type:uuid,nullzero," json:"related_skill_id"` + RelatedThoughtID resolvespec_common.SqlUUID `bun:"related_thought_id,type:uuid,nullzero," json:"related_thought_id"` + ReviewedAt resolvespec_common.SqlTimeStamp `bun:"reviewed_at,type:timestamptz,nullzero," json:"reviewed_at"` + ReviewedBy resolvespec_common.SqlString `bun:"reviewed_by,type:text,nullzero," json:"reviewed_by"` + SourceRef resolvespec_common.SqlString `bun:"source_ref,type:text,nullzero," json:"source_ref"` + SourceType resolvespec_common.SqlString `bun:"source_type,type:text,nullzero," json:"source_type"` + Status resolvespec_common.SqlString `bun:"status,type:text,default:'pending',notnull," json:"status"` + Summary resolvespec_common.SqlString `bun:"summary,type:text,notnull," json:"summary"` + SupersedesLearningID resolvespec_common.SqlUUID `bun:"supersedes_learning_id,type:uuid,nullzero," json:"supersedes_learning_id"` + Tags resolvespec_common.SqlStringArray `bun:"tags,type:text,default:'{}',notnull," json:"tags"` + UpdatedAt resolvespec_common.SqlTimeStamp `bun:"updated_at,type:timestamptz,default:now(),notnull," json:"updated_at"` + RelDuplicateOfLearningID *ModelPublicLearnings `bun:"rel:has-one,join:duplicate_of_learning_id=id" json:"relduplicateoflearningid,omitempty"` // Has one ModelPublicLearnings + RelProjectID *ModelPublicProjects `bun:"rel:has-one,join:project_id=guid" json:"relprojectid,omitempty"` // Has one ModelPublicProjects + RelRelatedSkillID *ModelPublicAgentSkills `bun:"rel:has-one,join:related_skill_id=id" json:"relrelatedskillid,omitempty"` // Has one ModelPublicAgentSkills + RelRelatedThoughtID *ModelPublicThoughts `bun:"rel:has-one,join:related_thought_id=guid" json:"relrelatedthoughtid,omitempty"` // Has one ModelPublicThoughts + RelSupersedesLearningID *ModelPublicLearnings `bun:"rel:has-one,join:supersedes_learning_id=id" json:"relsupersedeslearningid,omitempty"` // Has one ModelPublicLearnings } // TableName returns the table name for ModelPublicLearnings diff --git a/internal/generatedmodels/sql_public_plans.go b/internal/generatedmodels/sql_public_plans.go index 096e964..08fe517 100644 --- a/internal/generatedmodels/sql_public_plans.go +++ b/internal/generatedmodels/sql_public_plans.go @@ -9,29 +9,29 @@ import ( type ModelPublicPlans struct { bun.BaseModel `bun:"table:public.plans,alias:plans"` - ID resolvespec_common.SqlUUID `bun:"id,type:uuid,pk,default:gen_random_uuid()," json:"id"` - CompletedAt resolvespec_common.SqlTimeStamp `bun:"completed_at,type:timestamptz,nullzero," json:"completed_at"` - CreatedAt resolvespec_common.SqlTimeStamp `bun:"created_at,type:timestamptz,default:now(),notnull," json:"created_at"` - Description resolvespec_common.SqlString `bun:"description,type:text,default:'',notnull," json:"description"` - DueDate resolvespec_common.SqlTimeStamp `bun:"due_date,type:timestamptz,nullzero," json:"due_date"` - LastReviewedAt resolvespec_common.SqlTimeStamp `bun:"last_reviewed_at,type:timestamptz,nullzero," json:"last_reviewed_at"` - Owner resolvespec_common.SqlString `bun:"owner,type:text,nullzero," json:"owner"` - Priority resolvespec_common.SqlString `bun:"priority,type:text,default:'medium',notnull," json:"priority"` // low, medium, high, critical - ProjectID resolvespec_common.SqlUUID `bun:"project_id,type:uuid,nullzero," json:"project_id"` - ReviewedBy resolvespec_common.SqlString `bun:"reviewed_by,type:text,nullzero," json:"reviewed_by"` - Status resolvespec_common.SqlString `bun:"status,type:text,default:'draft',notnull," json:"status"` // draft, active, blocked, completed, cancelled, superseded - SupersedesPlanID resolvespec_common.SqlUUID `bun:"supersedes_plan_id,type:uuid,nullzero," json:"supersedes_plan_id"` - Tags resolvespec_common.SqlString `bun:"tags,type:text,default:'{}',notnull," json:"tags"` - Title resolvespec_common.SqlString `bun:"title,type:text,notnull," json:"title"` - UpdatedAt resolvespec_common.SqlTimeStamp `bun:"updated_at,type:timestamptz,default:now(),notnull," json:"updated_at"` - RelProjectID *ModelPublicProjects `bun:"rel:has-one,join:project_id=guid" json:"relprojectid,omitempty"` // Has one ModelPublicProjects - RelSupersedesPlanID *ModelPublicPlans `bun:"rel:has-one,join:supersedes_plan_id=id" json:"relsupersedesplanid,omitempty"` // Has one ModelPublicPlans - RelDependsOnPlanIDPublicPlanDependencies []*ModelPublicPlanDependencies `bun:"rel:has-many,join:id=depends_on_plan_id" json:"reldependsonplanidpublicplandependencies,omitempty"` // Has many ModelPublicPlanDependencies - RelPlanIDPublicPlanDependencies []*ModelPublicPlanDependencies `bun:"rel:has-many,join:id=plan_id" json:"relplanidpublicplandependencies,omitempty"` // Has many ModelPublicPlanDependencies - RelPlanAIDPublicPlanRelatedPlans []*ModelPublicPlanRelatedPlans `bun:"rel:has-many,join:id=plan_a_id" json:"relplanaidpublicplanrelatedplans,omitempty"` // Has many ModelPublicPlanRelatedPlans - RelPlanBIDPublicPlanRelatedPlans []*ModelPublicPlanRelatedPlans `bun:"rel:has-many,join:id=plan_b_id" json:"relplanbidpublicplanrelatedplans,omitempty"` // Has many ModelPublicPlanRelatedPlans - RelPlanIDPublicPlanSkills []*ModelPublicPlanSkills `bun:"rel:has-many,join:id=plan_id" json:"relplanidpublicplanskills,omitempty"` // Has many ModelPublicPlanSkills - RelPlanIDPublicPlanGuardrails []*ModelPublicPlanGuardrails `bun:"rel:has-many,join:id=plan_id" json:"relplanidpublicplanguardrails,omitempty"` // Has many ModelPublicPlanGuardrails + ID resolvespec_common.SqlUUID `bun:"id,type:uuid,pk,default:gen_random_uuid()," json:"id"` + CompletedAt resolvespec_common.SqlTimeStamp `bun:"completed_at,type:timestamptz,nullzero," json:"completed_at"` + CreatedAt resolvespec_common.SqlTimeStamp `bun:"created_at,type:timestamptz,default:now(),notnull," json:"created_at"` + Description resolvespec_common.SqlString `bun:"description,type:text,default:'',notnull," json:"description"` + DueDate resolvespec_common.SqlTimeStamp `bun:"due_date,type:timestamptz,nullzero," json:"due_date"` + LastReviewedAt resolvespec_common.SqlTimeStamp `bun:"last_reviewed_at,type:timestamptz,nullzero," json:"last_reviewed_at"` + Owner resolvespec_common.SqlString `bun:"owner,type:text,nullzero," json:"owner"` + Priority resolvespec_common.SqlString `bun:"priority,type:text,default:'medium',notnull," json:"priority"` // low, medium, high, critical + ProjectID resolvespec_common.SqlUUID `bun:"project_id,type:uuid,nullzero," json:"project_id"` + ReviewedBy resolvespec_common.SqlString `bun:"reviewed_by,type:text,nullzero," json:"reviewed_by"` + Status resolvespec_common.SqlString `bun:"status,type:text,default:'draft',notnull," json:"status"` // draft, active, blocked, completed, cancelled, superseded + SupersedesPlanID resolvespec_common.SqlUUID `bun:"supersedes_plan_id,type:uuid,nullzero," json:"supersedes_plan_id"` + Tags resolvespec_common.SqlStringArray `bun:"tags,type:text,default:'{}',notnull," json:"tags"` + Title resolvespec_common.SqlString `bun:"title,type:text,notnull," json:"title"` + UpdatedAt resolvespec_common.SqlTimeStamp `bun:"updated_at,type:timestamptz,default:now(),notnull," json:"updated_at"` + RelProjectID *ModelPublicProjects `bun:"rel:has-one,join:project_id=guid" json:"relprojectid,omitempty"` // Has one ModelPublicProjects + RelSupersedesPlanID *ModelPublicPlans `bun:"rel:has-one,join:supersedes_plan_id=id" json:"relsupersedesplanid,omitempty"` // Has one ModelPublicPlans + RelDependsOnPlanIDPublicPlanDependencies []*ModelPublicPlanDependencies `bun:"rel:has-many,join:id=depends_on_plan_id" json:"reldependsonplanidpublicplandependencies,omitempty"` // Has many ModelPublicPlanDependencies + RelPlanIDPublicPlanDependencies []*ModelPublicPlanDependencies `bun:"rel:has-many,join:id=plan_id" json:"relplanidpublicplandependencies,omitempty"` // Has many ModelPublicPlanDependencies + RelPlanAIDPublicPlanRelatedPlans []*ModelPublicPlanRelatedPlans `bun:"rel:has-many,join:id=plan_a_id" json:"relplanaidpublicplanrelatedplans,omitempty"` // Has many ModelPublicPlanRelatedPlans + RelPlanBIDPublicPlanRelatedPlans []*ModelPublicPlanRelatedPlans `bun:"rel:has-many,join:id=plan_b_id" json:"relplanbidpublicplanrelatedplans,omitempty"` // Has many ModelPublicPlanRelatedPlans + RelPlanIDPublicPlanSkills []*ModelPublicPlanSkills `bun:"rel:has-many,join:id=plan_id" json:"relplanidpublicplanskills,omitempty"` // Has many ModelPublicPlanSkills + RelPlanIDPublicPlanGuardrails []*ModelPublicPlanGuardrails `bun:"rel:has-many,join:id=plan_id" json:"relplanidpublicplanguardrails,omitempty"` // Has many ModelPublicPlanGuardrails } // TableName returns the table name for ModelPublicPlans diff --git a/internal/generatedmodels/sql_public_professional_contacts.go b/internal/generatedmodels/sql_public_professional_contacts.go index 422ea43..192ed40 100644 --- a/internal/generatedmodels/sql_public_professional_contacts.go +++ b/internal/generatedmodels/sql_public_professional_contacts.go @@ -20,7 +20,7 @@ type ModelPublicProfessionalContacts struct { Name resolvespec_common.SqlString `bun:"name,type:text,notnull," json:"name"` Notes resolvespec_common.SqlString `bun:"notes,type:text,nullzero," json:"notes"` Phone resolvespec_common.SqlString `bun:"phone,type:text,nullzero," json:"phone"` - Tags resolvespec_common.SqlString `bun:"tags,type:text,default:'{}',notnull," json:"tags"` + Tags resolvespec_common.SqlStringArray `bun:"tags,type:text,default:'{}',notnull," json:"tags"` Title resolvespec_common.SqlString `bun:"title,type:text,nullzero," json:"title"` UpdatedAt resolvespec_common.SqlTimeStamp `bun:"updated_at,type:timestamptz,default:now(),notnull," json:"updated_at"` RelContactIDPublicContactInteractions []*ModelPublicContactInteractions `bun:"rel:has-many,join:id=contact_id" json:"relcontactidpubliccontactinteractions,omitempty"` // Has many ModelPublicContactInteractions diff --git a/internal/generatedmodels/sql_public_recipes.go b/internal/generatedmodels/sql_public_recipes.go index 3f7fa23..b30f5ec 100644 --- a/internal/generatedmodels/sql_public_recipes.go +++ b/internal/generatedmodels/sql_public_recipes.go @@ -9,20 +9,20 @@ import ( type ModelPublicRecipes struct { bun.BaseModel `bun:"table:public.recipes,alias:recipes"` - ID resolvespec_common.SqlUUID `bun:"id,type:uuid,pk,default:gen_random_uuid()," json:"id"` - CookTimeMinutes resolvespec_common.SqlInt32 `bun:"cook_time_minutes,type:int,nullzero," json:"cook_time_minutes"` - CreatedAt resolvespec_common.SqlTimeStamp `bun:"created_at,type:timestamptz,default:now(),notnull," json:"created_at"` - Cuisine resolvespec_common.SqlString `bun:"cuisine,type:text,nullzero," json:"cuisine"` - Ingredients resolvespec_common.SqlJSONB `bun:"ingredients,type:jsonb,default:'',notnull," json:"ingredients"` - Instructions resolvespec_common.SqlJSONB `bun:"instructions,type:jsonb,default:'',notnull," json:"instructions"` - Name resolvespec_common.SqlString `bun:"name,type:text,notnull," json:"name"` - Notes resolvespec_common.SqlString `bun:"notes,type:text,nullzero," json:"notes"` - PrepTimeMinutes resolvespec_common.SqlInt32 `bun:"prep_time_minutes,type:int,nullzero," json:"prep_time_minutes"` - Rating resolvespec_common.SqlInt32 `bun:"rating,type:int,nullzero," json:"rating"` - Servings resolvespec_common.SqlInt32 `bun:"servings,type:int,nullzero," json:"servings"` - Tags resolvespec_common.SqlString `bun:"tags,type:text,default:'{}',notnull," json:"tags"` - UpdatedAt resolvespec_common.SqlTimeStamp `bun:"updated_at,type:timestamptz,default:now(),notnull," json:"updated_at"` - RelRecipeIDPublicMealPlans []*ModelPublicMealPlans `bun:"rel:has-many,join:id=recipe_id" json:"relrecipeidpublicmealplans,omitempty"` // Has many ModelPublicMealPlans + ID resolvespec_common.SqlUUID `bun:"id,type:uuid,pk,default:gen_random_uuid()," json:"id"` + CookTimeMinutes resolvespec_common.SqlInt32 `bun:"cook_time_minutes,type:int,nullzero," json:"cook_time_minutes"` + CreatedAt resolvespec_common.SqlTimeStamp `bun:"created_at,type:timestamptz,default:now(),notnull," json:"created_at"` + Cuisine resolvespec_common.SqlString `bun:"cuisine,type:text,nullzero," json:"cuisine"` + Ingredients resolvespec_common.SqlJSONB `bun:"ingredients,type:jsonb,default:'',notnull," json:"ingredients"` + Instructions resolvespec_common.SqlJSONB `bun:"instructions,type:jsonb,default:'',notnull," json:"instructions"` + Name resolvespec_common.SqlString `bun:"name,type:text,notnull," json:"name"` + Notes resolvespec_common.SqlString `bun:"notes,type:text,nullzero," json:"notes"` + PrepTimeMinutes resolvespec_common.SqlInt32 `bun:"prep_time_minutes,type:int,nullzero," json:"prep_time_minutes"` + Rating resolvespec_common.SqlInt32 `bun:"rating,type:int,nullzero," json:"rating"` + Servings resolvespec_common.SqlInt32 `bun:"servings,type:int,nullzero," json:"servings"` + Tags resolvespec_common.SqlStringArray `bun:"tags,type:text,default:'{}',notnull," json:"tags"` + UpdatedAt resolvespec_common.SqlTimeStamp `bun:"updated_at,type:timestamptz,default:now(),notnull," json:"updated_at"` + RelRecipeIDPublicMealPlans []*ModelPublicMealPlans `bun:"rel:has-many,join:id=recipe_id" json:"relrecipeidpublicmealplans,omitempty"` // Has many ModelPublicMealPlans } // TableName returns the table name for ModelPublicRecipes diff --git a/internal/generatedmodels/sql_public_thoughts.go b/internal/generatedmodels/sql_public_thoughts.go index 3f1dec3..dfde207 100644 --- a/internal/generatedmodels/sql_public_thoughts.go +++ b/internal/generatedmodels/sql_public_thoughts.go @@ -14,7 +14,7 @@ type ModelPublicThoughts struct { Content resolvespec_common.SqlString `bun:"content,type:text,notnull," json:"content"` CreatedAt resolvespec_common.SqlTimeStamp `bun:"created_at,type:timestamptz,default:now(),nullzero," json:"created_at"` GUID resolvespec_common.SqlUUID `bun:"guid,type:uuid,default:gen_random_uuid(),notnull," json:"guid"` - Metadata resolvespec_common.SqlJSONB `bun:"metadata,type:jsonb,default:'{}::jsonb',nullzero," json:"metadata"` + Metadata resolvespec_common.SqlJSONB `bun:"metadata,type:jsonb,default:{}::jsonb,nullzero," json:"metadata"` ProjectID resolvespec_common.SqlUUID `bun:"project_id,type:uuid,nullzero," json:"project_id"` UpdatedAt resolvespec_common.SqlTimeStamp `bun:"updated_at,type:timestamptz,default:now(),nullzero," json:"updated_at"` RelProjectID *ModelPublicProjects `bun:"rel:has-one,join:project_id=guid" json:"relprojectid,omitempty"` // Has one ModelPublicProjects diff --git a/migrations/020_generated_schema.sql b/migrations/020_generated_schema.sql index 2d56c12..5a90b6c 100644 --- a/migrations/020_generated_schema.sql +++ b/migrations/020_generated_schema.sql @@ -119,7 +119,7 @@ CREATE TABLE IF NOT EXISTS public.important_dates ( id uuid NOT NULL DEFAULT gen_random_uuid(), notes text, recurring_yearly boolean NOT NULL DEFAULT false, - reminder_days_before integer NOT NULL DEFAULT '7', + reminder_days_before integer NOT NULL DEFAULT 7, title text NOT NULL ); @@ -129,7 +129,7 @@ CREATE TABLE IF NOT EXISTS public.thoughts ( created_at timestamptz DEFAULT now(), guid uuid NOT NULL DEFAULT gen_random_uuid(), id bigserial NOT NULL, - metadata jsonb DEFAULT '''{}''::jsonb', + metadata jsonb DEFAULT '{}'::jsonb, project_id uuid, updated_at timestamptz DEFAULT now() ); @@ -174,7 +174,7 @@ CREATE TABLE IF NOT EXISTS public.professional_contacts ( name text NOT NULL, notes text, phone text, - tags text[] NOT NULL DEFAULT '''{}''', + tags text[] NOT NULL DEFAULT '{}', title text, updated_at timestamptz NOT NULL DEFAULT now() ); @@ -222,7 +222,7 @@ CREATE TABLE IF NOT EXISTS public.stored_files ( CREATE TABLE IF NOT EXISTS public.household_items ( category text, created_at timestamptz NOT NULL DEFAULT now(), - details jsonb NOT NULL DEFAULT '''{}''', + details jsonb NOT NULL DEFAULT '{}', id uuid NOT NULL DEFAULT gen_random_uuid(), location text, name text NOT NULL, @@ -271,14 +271,14 @@ CREATE TABLE IF NOT EXISTS public.recipes ( created_at timestamptz NOT NULL DEFAULT now(), cuisine text, id uuid NOT NULL DEFAULT gen_random_uuid(), - ingredients jsonb NOT NULL DEFAULT '''[]''', - instructions jsonb NOT NULL DEFAULT '''[]''', + ingredients jsonb NOT NULL DEFAULT '[]', + instructions jsonb NOT NULL DEFAULT '[]', name text NOT NULL, notes text, prep_time_minutes integer, rating integer, servings integer, - tags text[] NOT NULL DEFAULT '''{}''', + tags text[] NOT NULL DEFAULT '{}', updated_at timestamptz NOT NULL DEFAULT now() ); @@ -297,7 +297,7 @@ CREATE TABLE IF NOT EXISTS public.meal_plans ( CREATE TABLE IF NOT EXISTS public.shopping_lists ( created_at timestamptz NOT NULL DEFAULT now(), id uuid NOT NULL DEFAULT gen_random_uuid(), - items jsonb NOT NULL DEFAULT '''[]''', + items jsonb NOT NULL DEFAULT '[]', notes text, updated_at timestamptz NOT NULL DEFAULT now(), week_start date NOT NULL @@ -308,8 +308,8 @@ CREATE TABLE IF NOT EXISTS public.chat_histories ( channel text, created_at timestamptz NOT NULL DEFAULT now(), id uuid NOT NULL DEFAULT gen_random_uuid(), - messages jsonb NOT NULL DEFAULT '''[]''', - metadata jsonb NOT NULL DEFAULT '''{}''', + messages jsonb NOT NULL DEFAULT '[]', + metadata jsonb NOT NULL DEFAULT '{}', project_id uuid, session_id text NOT NULL, summary text, @@ -345,7 +345,7 @@ CREATE TABLE IF NOT EXISTS public.learnings ( status text NOT NULL DEFAULT 'pending', summary text NOT NULL, supersedes_learning_id uuid, - tags text[] NOT NULL DEFAULT '''{}''', + tags text[] NOT NULL DEFAULT '{}', updated_at timestamptz NOT NULL DEFAULT now() ); @@ -362,7 +362,7 @@ CREATE TABLE IF NOT EXISTS public.plans ( reviewed_by text, status text NOT NULL DEFAULT 'draft', supersedes_plan_id uuid, - tags text[] NOT NULL DEFAULT '''{}''', + tags text[] NOT NULL DEFAULT '{}', title text NOT NULL, updated_at timestamptz NOT NULL DEFAULT now() ); @@ -401,7 +401,7 @@ CREATE TABLE IF NOT EXISTS public.agent_skills ( description text NOT NULL DEFAULT '', id uuid NOT NULL DEFAULT gen_random_uuid(), name text NOT NULL, - tags text[] NOT NULL DEFAULT '''{}''', + tags text[] NOT NULL DEFAULT '{}', updated_at timestamptz NOT NULL DEFAULT now() ); @@ -412,7 +412,7 @@ CREATE TABLE IF NOT EXISTS public.agent_guardrails ( id uuid NOT NULL DEFAULT gen_random_uuid(), name text NOT NULL, severity text NOT NULL DEFAULT 'medium', - tags text[] NOT NULL DEFAULT '''{}''', + tags text[] NOT NULL DEFAULT '{}', updated_at timestamptz NOT NULL DEFAULT now() ); @@ -751,7 +751,7 @@ BEGIN AND table_name = 'important_dates' AND column_name = 'reminder_days_before' ) THEN - ALTER TABLE public.important_dates ADD COLUMN reminder_days_before integer NOT NULL DEFAULT '7'; + ALTER TABLE public.important_dates ADD COLUMN reminder_days_before integer NOT NULL DEFAULT 7; END IF; END; $$; @@ -842,7 +842,7 @@ BEGIN AND table_name = 'thoughts' AND column_name = 'metadata' ) THEN - ALTER TABLE public.thoughts ADD COLUMN metadata jsonb DEFAULT '''{}''::jsonb'; + ALTER TABLE public.thoughts ADD COLUMN metadata jsonb DEFAULT '{}'::jsonb; END IF; END; $$; @@ -1271,7 +1271,7 @@ BEGIN AND table_name = 'professional_contacts' AND column_name = 'tags' ) THEN - ALTER TABLE public.professional_contacts ADD COLUMN tags text[] NOT NULL DEFAULT '''{}'''; + ALTER TABLE public.professional_contacts ADD COLUMN tags text[] NOT NULL DEFAULT '{}'; END IF; END; $$; @@ -1739,7 +1739,7 @@ BEGIN AND table_name = 'household_items' AND column_name = 'details' ) THEN - ALTER TABLE public.household_items ADD COLUMN details jsonb NOT NULL DEFAULT '''{}'''; + ALTER TABLE public.household_items ADD COLUMN details jsonb NOT NULL DEFAULT '{}'; END IF; END; $$; @@ -2220,7 +2220,7 @@ BEGIN AND table_name = 'recipes' AND column_name = 'ingredients' ) THEN - ALTER TABLE public.recipes ADD COLUMN ingredients jsonb NOT NULL DEFAULT '''[]'''; + ALTER TABLE public.recipes ADD COLUMN ingredients jsonb NOT NULL DEFAULT '[]'; END IF; END; $$; @@ -2233,7 +2233,7 @@ BEGIN AND table_name = 'recipes' AND column_name = 'instructions' ) THEN - ALTER TABLE public.recipes ADD COLUMN instructions jsonb NOT NULL DEFAULT '''[]'''; + ALTER TABLE public.recipes ADD COLUMN instructions jsonb NOT NULL DEFAULT '[]'; END IF; END; $$; @@ -2311,7 +2311,7 @@ BEGIN AND table_name = 'recipes' AND column_name = 'tags' ) THEN - ALTER TABLE public.recipes ADD COLUMN tags text[] NOT NULL DEFAULT '''{}'''; + ALTER TABLE public.recipes ADD COLUMN tags text[] NOT NULL DEFAULT '{}'; END IF; END; $$; @@ -2480,7 +2480,7 @@ BEGIN AND table_name = 'shopping_lists' AND column_name = 'items' ) THEN - ALTER TABLE public.shopping_lists ADD COLUMN items jsonb NOT NULL DEFAULT '''[]'''; + ALTER TABLE public.shopping_lists ADD COLUMN items jsonb NOT NULL DEFAULT '[]'; END IF; END; $$; @@ -2584,7 +2584,7 @@ BEGIN AND table_name = 'chat_histories' AND column_name = 'messages' ) THEN - ALTER TABLE public.chat_histories ADD COLUMN messages jsonb NOT NULL DEFAULT '''[]'''; + ALTER TABLE public.chat_histories ADD COLUMN messages jsonb NOT NULL DEFAULT '[]'; END IF; END; $$; @@ -2597,7 +2597,7 @@ BEGIN AND table_name = 'chat_histories' AND column_name = 'metadata' ) THEN - ALTER TABLE public.chat_histories ADD COLUMN metadata jsonb NOT NULL DEFAULT '''{}'''; + ALTER TABLE public.chat_histories ADD COLUMN metadata jsonb NOT NULL DEFAULT '{}'; END IF; END; $$; @@ -2987,7 +2987,7 @@ BEGIN AND table_name = 'learnings' AND column_name = 'tags' ) THEN - ALTER TABLE public.learnings ADD COLUMN tags text[] NOT NULL DEFAULT '''{}'''; + ALTER TABLE public.learnings ADD COLUMN tags text[] NOT NULL DEFAULT '{}'; END IF; END; $$; @@ -3169,7 +3169,7 @@ BEGIN AND table_name = 'plans' AND column_name = 'tags' ) THEN - ALTER TABLE public.plans ADD COLUMN tags text[] NOT NULL DEFAULT '''{}'''; + ALTER TABLE public.plans ADD COLUMN tags text[] NOT NULL DEFAULT '{}'; END IF; END; $$; @@ -3481,7 +3481,7 @@ BEGIN AND table_name = 'agent_skills' AND column_name = 'tags' ) THEN - ALTER TABLE public.agent_skills ADD COLUMN tags text[] NOT NULL DEFAULT '''{}'''; + ALTER TABLE public.agent_skills ADD COLUMN tags text[] NOT NULL DEFAULT '{}'; END IF; END; $$; @@ -3585,7 +3585,7 @@ BEGIN AND table_name = 'agent_guardrails' AND column_name = 'tags' ) THEN - ALTER TABLE public.agent_guardrails ADD COLUMN tags text[] NOT NULL DEFAULT '''{}'''; + ALTER TABLE public.agent_guardrails ADD COLUMN tags text[] NOT NULL DEFAULT '{}'; END IF; END; $$; @@ -4574,7 +4574,7 @@ CREATE INDEX IF NOT EXISTS idx_learnings_tags ON public.learnings USING gin (tags gin_trgm_ops); CREATE INDEX IF NOT EXISTS idx_plans_tags - ON public.plans USING gin (tags gin_trgm_ops); + ON public.plans USING gin (tags); CREATE INDEX IF NOT EXISTS idx_plans_title ON public.plans USING gin (title gin_trgm_ops);