<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
                   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-2.0.xsd"
                   logicalFilePath="db-changelog-000131-drop-saml-settings-constraints.xml">

  <changeSet author="appian" id="tag-000130">
    <tagDatabase tag="000130"/>
  </changeSet>

  <changeSet author="appian" id="000131.1.0">
    <comment>Drop saml_settings table</comment>
    <dropTable tableName="saml_settings"/>
  </changeSet>

  <changeSet author="appian" id="000130.1.1">
    <comment>Recreate saml_settings table</comment>
    <createTable tableName="saml_settings">
      <column name="id" type="${longType}" autoIncrement="${autoIncrement}">
        <constraints nullable="false" primaryKey="true"/>
      </column>
      <column name="idp_entity_id" type="${stringType}(1024)"/>
      <column name="friendly_name" type="${shortStringType}"/>
      <column name="description" type="${shortStringType}"/>
      <column name="idp_metadata_uuid" type="${shortStringType}"/>
      <column name="sp_certificate" type="${shortStringType}"/>
      <column name="sp_certificate_filename" type="${stringType}(1000)"/>
      <column name="sp_req_signature_hash_method" type="${shortStringType}"/>
      <column name="sp_entity_id" type="${stringType}(1024)"/>
      <column name="sp_name" type="${stringType}(1000)"/>
      <column name="group_uuid" type="${shortStringType}"/>
      <column name="auto_create_users" type="${booleanType}"/>
      <column name="use_username_attr" type="${booleanType}"/>
      <column name="username_attr" type="${stringType}(1000)"/>
      <column name="first_name_attr" type="${stringType}(1000)"/>
      <column name="last_name_attr" type="${stringType}(1000)"/>
      <column name="email_attr" type="${stringType}(1000)"/>
      <column name="allow_lowercase_username" type="${booleanType}"/>
      <column name="min_authn_method" type="${shortStringType}"/>
      <column name="mobile_auth_popup" type="${booleanType}"/>
      <column name="priority" type="${integerType}"/>
    </createTable>
    <modifySql dbms="mysql">
      <append value="${mysqlEngineSql}"/>
    </modifySql>
  </changeSet>

</databaseChangeLog>
