> For the complete documentation index, see [llms.txt](https://docs.flosum.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flosum.com/devops/devops-ja/kdo/buranchi/buranchihenonono.md).

# ブランチへの事前・事後の破壊的変更の追加

破壊的変更を使用して、デプロイ中に Salesforce のメタデータコンポーネントを削除します。削除がいつ行われるかを制御するために、Pre または Post として設定できます。

## ![](https://225042527-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FG5ZbxX918xOHwbAwAJ4n%2FSummary2-Small-Icon.svg?alt=media\&token=da26a67f-ff7f-47b3-8669-06be960dc2d7) 概要 <a href="#what-are-destructive-changes" id="what-are-destructive-changes"></a>

破壊的変更を使用すると、デプロイの一環として Salesforce 組織からメタデータを削除できます。たとえば、未使用のフィールド、クラス、またはコンポーネントを削除したい場合があります。Flosum DevOps では、破壊的変更は次の 2 つの方法で適用できます。

* **事前破壊的変更**: 削除はメインのデプロイ前に行われます。
* **事後破壊的変更**: 削除はメインのデプロイ後に行われます。

{% hint style="warning" %}

#### デプロイ

実行するとき **デプロイ** または **検証** アクションでは、破壊的変更が自動的に含まれます。これらは、Pre か Post かに応じて順番に実行されます。
{% endhint %}

{% hint style="info" %}

#### ベストプラクティス

* 使用する **事前破壊的** 変更を使用して、新しいデプロイと競合する可能性のあるメタデータを削除します。
* 使用する **事後破壊的** 変更を使用して、新しいコンポーネントがデプロイされた後にクリーンアップします。
* 常に破壊的変更を含むデプロイを検証し、重要なメタデータが誤って削除されないようにしてください。
  {% endhint %}

事前破壊的変更と事後破壊的変更を追加する手順は同じであるため、この記事では事前破壊的変更の追加方法を説明します。

## 破壊的変更の追加

{% stepper %}
{% step %}

### ブランチを選択

1. クリック **ブランチ** を左サイドバーのメニューから選択します。
2. 一覧からブランチを選択します。

   <div align="left"><figure><img src="https://225042527-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2Fa9KT0NxgbPAX6fQdWcPM%2FAddingPreAndPostDestructiveChangesToABranch-S01-01.png?alt=media&amp;token=a362e977-c0df-4838-9cd3-cd58e3001cb2" alt="" width="563"><figcaption></figcaption></figure></div>

{% endstep %}

{% step %}

### 破壊的変更の追加

1. の **コンポーネント** タブで、 **破壊的変更** テーブルセレクターをクリックします。
2. クリック **+ 事前変更を追加**.

   <div align="left"><figure><img src="https://225042527-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FZ4tnq4khwzR5DyQQm1PN%2FAddingPreAndPostDestructiveChangesToABranch-S02-02.png?alt=media&amp;token=c9ebe56b-76e6-4837-96e1-509be8297707" alt="" width="563"><figcaption></figcaption></figure></div>
3. を選択します **ソースタイプ**:
   1. **組織**: Salesforce 組織から、破壊的変更に含めるコンポーネントを選択できます。
   2. **ブランチ**: ブランチから、破壊的変更に含めるコンポーネントを選択できます。
4. クリック **続行**.&#x20;

   <div align="left"><figure><img src="https://225042527-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FEi1HHERVF1mTubJ9rRWe%2FAddingPreAndPostDestructiveChangesToABranch-S02-04.png?alt=media&amp;token=13abdce9-ea69-4fd7-9b15-2557fa9a0433" alt="" width="375"><figcaption></figcaption></figure></div>
5. クリック **選択し、** コンポーネントを追加する対象の組織またはブランチを
6. クリック **次へ**.

   <div align="left"><figure><img src="https://225042527-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FI9cALtMPR9ehPu8aETC0%2FAddingPreAndPostDestructiveChangesToABranch-S02-05.png?alt=media&amp;token=0df51aab-2462-4a6c-96bc-caf68ad4c65c" alt="" width="563"><figcaption></figcaption></figure></div>

{% endstep %}

{% step %}

### コンポーネントを選択

1. 検索、フィルター、並べ替えを使って、破壊的変更に追加するコンポーネントを見つけます。

   <div align="left"><figure><img src="https://225042527-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FVWx6mWcS9lHvxGSQI1Bo%2FAddingPreAndPostDestructiveChangesToABranch-S03-01.png?alt=media&amp;token=ba0a322d-3659-4199-9419-6b6f1c536ee7" alt="" width="563"><figcaption></figcaption></figure></div>
2. クリック **選択し、** 各コンポーネントに対して追加します。
3. クリック **+ 追加** すべてのコンポーネントが選択されたら

   <div align="left"><figure><img src="https://225042527-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2F3aKgNXt32MppKptRLnFn%2FAddingPreAndPostDestructiveChangesToABranch-S03-02.png?alt=media&amp;token=d2d48820-1b33-4d5b-8aed-3af8c09d4c21" alt="" width="563"><figcaption></figcaption></figure></div>
4. 追加したコンポーネントは **破壊的変更** テーブルに一覧表示されます。テーブルの **デプロイタイプ** 列には、各変更が **事前** または **事後**.

   <div align="left"><figure><img src="https://225042527-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FVLKP1RRnGfCBEHc0T3DS%2FAddingPreAndPostDestructiveChangesToABranch-S03-03.png?alt=media&amp;token=9f85cf48-2aaf-4644-a290-d019bc200f41" alt="" width="563"><figcaption></figcaption></figure></div>

{% endstep %}
{% endstepper %}

## 破壊的変更の管理 <a href="#managing-destructive-changes" id="managing-destructive-changes"></a>

コンポーネントを **破壊的変更** テーブルに追加した後は、デプロイタイプを変更したり、完全に削除したりして管理できます。

{% stepper %}
{% step %}

### デプロイタイプの変更

デプロイタイプを **事前** と **事後**の間で切り替えることができます。テーブルの **Post/Pre に変更** オプションは、破壊的変更に現在設定されているデプロイタイプによって異なります。

1. をクリックします **三点** メニューで、更新したい破壊的変更を選択します。
2. クリック **Post/Pre に変更**.

   <div align="left"><figure><img src="https://225042527-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FLPBy5LA6ZTYwzrskZEUW%2FAddingPreAndPostDestructiveChangesToABranch-S04-01.png?alt=media&amp;token=fdfc983b-9c32-4756-837e-c17ea7b71d27" alt="" width="563"><figcaption></figcaption></figure></div>
3. 破壊的変更は、直ちにデプロイタイプが切り替わります。
   {% endstep %}

{% step %}

### 破壊的変更の削除

1. をクリックします **三点** メニューで、削除したい破壊的変更を選択します。
2. クリック **削除**.

   <div align="left"><figure><img src="https://225042527-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FG43GszvoyjkF4gBhXGZe%2FAddingPreAndPostDestructiveChangesToABranch-S04-02.png?alt=media&amp;token=7656fdc4-e538-466a-9584-5ec6f898728d" alt="" width="563"><figcaption></figcaption></figure></div>
3. クリック **はい、削除します** の **コンポーネントの削除** 確認ダイアログで。

   <div align="left"><figure><img src="https://225042527-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FlcNtMKdKrUhsGcRM5rSk%2FAddingPreAndPostDestructiveChangesToABranch-S04-03.png?alt=media&amp;token=18f82b87-4b32-4181-b674-e8b48f1799a7" alt="" width="375"><figcaption></figcaption></figure></div>

{% hint style="info" %}
破壊的変更コンポーネントを削除しても、ブランチからコンポーネントは削除されません。破壊的変更から取り除かれるだけです。
{% endhint %}
{% endstep %}
{% endstepper %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.flosum.com/devops/devops-ja/kdo/buranchi/buranchihenonono.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
