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

    <!--
        Added the entity Disponibilita.
    -->
    <changeSet id="20251210161122-1" author="jhipster">
        <createTable tableName="disponibilita">
            <column name="id" type="bigint">
                <constraints primaryKey="true" nullable="false"/>
            </column>
            <column name="giorno_settimana" type="varchar(255)">
                <constraints nullable="true" />
            </column>
            <column name="data_specifica" type="date">
                <constraints nullable="true" />
            </column>
            <column name="ora_inizio" type="${datetimeType}">
                <constraints nullable="true" />
            </column>
            <column name="ora_fine" type="${datetimeType}">
                <constraints nullable="true" />
            </column>
            <column name="orario_inizio" type="varchar(255)">
                <constraints nullable="true" />
            </column>
            <column name="orario_fine" type="varchar(255)">
                <constraints nullable="true" />
            </column>
            <column name="tipo" type="varchar(255)">
                <constraints nullable="true" />
            </column>
            <column name="note" type="varchar(255)">
                <constraints nullable="true" />
            </column>
            <column name="struttura_id" type="bigint">
                <constraints nullable="true" />
            </column>
            <!-- jhipster-needle-liquibase-add-column - JHipster will add columns here -->
        </createTable>
        <dropDefaultValue tableName="disponibilita" columnName="ora_inizio" columnDataType="${datetimeType}"/>
        <dropDefaultValue tableName="disponibilita" columnName="ora_fine" columnDataType="${datetimeType}"/>
    </changeSet>

    <!-- jhipster-needle-liquibase-add-changeset - JHipster will add changesets here -->

    <!--
        Load sample data generated with Faker.js
        - This data can be easily edited using a CSV editor (or even MS Excel) and
          is located in the 'src/main/resources/config/liquibase/fake-data' directory
        - By default this data is applied when running with the JHipster 'dev' profile.
          This can be customized by adding or removing 'faker' in the 'spring.liquibase.contexts'
          Spring Boot configuration key.
    -->
    <changeSet id="20251210161122-1-data" author="jhipster" context="faker">
        <loadData
                  file="config/liquibase/fake-data/disponibilita.csv"
                  separator=";"
                  tableName="disponibilita"
                  usePreparedStatements="true">
            <column name="id" type="numeric"/>
            <column name="giorno_settimana" type="string"/>
            <column name="data_specifica" type="date"/>
            <column name="ora_inizio" type="date"/>
            <column name="ora_fine" type="date"/>
            <column name="orario_inizio" type="string"/>
            <column name="orario_fine" type="string"/>
            <column name="tipo" type="string"/>
            <column name="note" type="string"/>
            <!-- jhipster-needle-liquibase-add-loadcolumn - JHipster (and/or extensions) can add load columns here -->
        </loadData>
    </changeSet>
</databaseChangeLog>
