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

  <changeSet id="0001" author="tihomirov">
    <comment>add admin_role column to user_application_role table</comment>
    <sql>
      ALTER TABLE IF EXISTS public.user_application_role ADD COLUMN IF NOT EXISTS admin_role boolean;
      COMMENT ON COLUMN public.user_application_role.admin_role IS 'Признак роли администратора';
    </sql>
  </changeSet>

  <changeSet id="0002" author="tihomirov">
    <comment>add default value to admin_role</comment>
    <sql>
      UPDATE public.user_application_role SET admin_role = true
      WHERE role_code IN ('gomu_supervisor', 'system_administrator', 'security_administrator');
    </sql>
  </changeSet>

</databaseChangeLog>
