Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-- Create default version for projects that don't have any versions
INSERT INTO "project_versions" ("id", "project_id", "version", "prerelease", "latest", "created_at", "updated_at")
SELECT
gen_random_uuid() as id,
p.id as project_id,
'' as version,
true as prerelease,
true as latest,
p.created_at as created_at,
p.updated_at as updated_at
FROM "projects" p
WHERE p.deleted_at IS NULL
AND NOT EXISTS (
SELECT 1 FROM "project_versions" pv
WHERE pv.project_id = p.id
AND pv.deleted_at IS NULL
);
3 changes: 2 additions & 1 deletion app/controlplane/pkg/data/ent/migrate/migrations/atlas.sum
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
h1:QaClWT8b1Nr8BRNI+5O2WAYbWl/5tTlopLggA6RQwzw=
h1:x6Aaqyf5LL8bB+ApOOevCGz3+dZFPb31NMn1U3QT8ek=
20230706165452_init-schema.sql h1:VvqbNFEQnCvUVyj2iDYVQQxDM0+sSXqocpt/5H64k8M=
20230710111950-cas-backend.sql h1:A8iBuSzZIEbdsv9ipBtscZQuaBp3V5/VMw7eZH6GX+g=
20230712094107-cas-backends-workflow-runs.sql h1:a5rzxpVGyd56nLRSsKrmCFc9sebg65RWzLghKHh5xvI=
Expand Down Expand Up @@ -108,3 +108,4 @@ h1:QaClWT8b1Nr8BRNI+5O2WAYbWl/5tTlopLggA6RQwzw=
20250808164400.sql h1:r7S2LM8d3kbKQ7WNuggjvmNw3kcccx0rYzzklw8Q2I8=
20250808165202.sql h1:Oreh9FpYwo/cdcs3Oza/+ACzScXeTRBGIEvua8RqoLo=
20250812111458.sql h1:15yQlZoBymYR5GEjGLtV/j4ZZjg06u6eEzcRRl7vax4=
20250820090420.sql h1:xmJucXMVs+JyXWmyHu7Rv31hhgtAONDTv1mT/sTaJKk=
2 changes: 1 addition & 1 deletion app/controlplane/pkg/data/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func (r *WorkflowRepo) Create(ctx context.Context, opts *biz.WorkflowCreateOpts)
return fmt.Errorf("finding project version: %w", err)
}

if _, err := createProjectVersionWithTx(ctx, tx, projectID, "", false); err != nil {
if _, err := createProjectVersionWithTx(ctx, tx, projectID, "", true); err != nil {
return fmt.Errorf("creating project version: %w", err)
}
}
Expand Down
Loading