Fix build create (#923)

## Description

1. What is this PR about (link the issue and add a short description)

## Steps for reproduction

1. click button
2. expect xyz

## Code Review

- [ ] hi @kof, I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio-designer/blob/main/apps/designer/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `designer/env-check.js` if mandatory
This commit is contained in:
Ivan Starkov authored and GitHub committed 2023-02-02 15:34:44 +04:00
1 parent 505fdac672
commit f063d7e2d5
1 file changed
+7 -7
+7 -7
View File
@@ -258,6 +258,13 @@ export async function create(
? (await db.breakpoints.load(sourceBuild.id)).values
: db.breakpoints.createValues();
if (env === "prod") {
await client.build.updateMany({
where: { projectId: projectId, isProd: true },
data: { isProd: false },
});
}
const build = await client.build.create({
data: {
projectId,
@@ -274,13 +281,6 @@ export async function create(
? await createPages({ projectId, buildId: build.id }, client)
: await clonePages(sourceBuild.pages, client);
if (env === "prod") {
await client.build.updateMany({
where: { projectId: projectId, isProd: true },
data: { isProd: false },
});
}
await client.build.update({
where: {
id: build.id,