Updating fk constraint problem while updating fk values in a table

In a Spring Boot app, we are trying to update a fk constraint in a table and change its reference to another table. Here are the related changeset below:

<?xml version="1.0" encoding="utf-8"?>
        xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.9.xsd">

    <changeSet id="202401010900 - update data" author="author" context="local" runOnChange="true">
        <loadUpdateData file="config/liquibase/data/purchase_order.csv"

    <changeSet id="202401011000 - add fk constraint" author="author">
        <addForeignKeyConstraint baseTableName="purchase_order" baseColumnNames="unit_id"
                                 constraintName="fk_unit" deferrable="false" initiallyDeferred="false"
                                 onDelete="NO ACTION" onUpdate="NO ACTION"
                                 referencedColumnNames="id" referencedTableName="unit"

It is working in this way, but as we use ddl and data update changelogs in different folder, I need to move the second changeset to a separate folder, data-update, it gives the following error (changesets in ddl are executed before the ones in data-update folder):

ERROR: insert or update on table “purchase_order” violates foreign key constraint “fk_unit”
Detail: Key (unit_id)=(100) is not present in table “unit”.

But in the purchase_order.csv, the data with this unit_id exists and I think when Liquibase changesets are executed in different databaseChangeLog, the change is not detected based on the execution order:

  1. drop fk constraints
  2. update data
  3. add fk constraints (as we execute ddl operations first (1 and 3) at the same time based on our liquibase config, this problem occurs)

So, is it possible to fix the problem by moving the addForeignKeyConstraint changeset to the ddl folder? Or, do I have to add fk even after loading/updating data in the same databaseChangeLog ?