<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog
    xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
    xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd
                        http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">

    <!--
        Altered the entity DashboardComponent.
        #1 Add relation column to another DashboardComponent
    -->
    <changeSet id="20250318010000-1" author="omg">
    	<!-- Step 1: Add column -->
    	<addColumn tableName="dashboard_component">
            <column name="target_dashboard_component_id" type="bigint">
                <constraints nullable="true" />
            </column>
	    </addColumn>
	    
	    <!-- Step 2: Add FK -->
        <addForeignKeyConstraint baseColumnNames="target_dashboard_component_id"
                                 baseTableName="dashboard_component"
                                 constraintName="fk_dashboard_component__target_dashboard_component_id"
                                 referencedColumnNames="id"
                                 referencedTableName="dashboard_component"
                                 />
    </changeSet>
</databaseChangeLog>
