<?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">

    <!--
        Add single output unique variable flag, and target_owner.
    -->
    <changeSet id="20250412010000-1" author="omg">
    	<addColumn tableName="variable">
            <column name="output_single" type="boolean">
            	<constraints nullable="true" />
            </column>
	    </addColumn>
	    
	    <addColumn tableName="variable">
	    	<column name="output_owner_id" type="bigint">
                <constraints nullable="true" />
            </column>
        </addColumn>
    </changeSet>
    
    <changeSet id="20250412010000-2" author="omg">
        <addForeignKeyConstraint baseColumnNames="output_owner_id"
                                 baseTableName="variable"
                                 constraintName="fk_variable__owner_id"
                                 referencedColumnNames="id"
                                 referencedTableName="organization"
                                 />
    </changeSet>
</databaseChangeLog>
