<?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="saliakhov">
        <comment>create table</comment>
		<sql>
			CREATE TABLE IF NOT EXISTS admin_indicators.user_activity (
				user_activity_id bigserial NOT NULL,
				recruitment_id varchar(36) NOT NULL,
				update_date timestamp DEFAULT now() NOT NULL,
				info_date date NOT NULL,
				count_user_activity int8 DEFAULT 0 NOT NULL,
				CONSTRAINT user_activity_pkey PRIMARY KEY (user_activity_id)
			  );
			  CREATE INDEX IF NOT EXISTS idx_user_activity_date ON admin_indicators.user_activity USING btree (info_date);
			  CREATE INDEX IF NOT EXISTS idx_user_activity_recr ON admin_indicators.user_activity USING btree (recruitment_id);
			  CREATE INDEX IF NOT EXISTS idx_user_activity_recr_date ON admin_indicators.user_activity USING btree (recruitment_id, info_date);

			  COMMENT ON COLUMN admin_indicators.user_activity.count_user_activity IS 'Количество активных пользователей';

			  ALTER TABLE IF EXISTS admin_indicators.user_activity OWNER TO ervu_business_metrics;
		</sql>
	</changeSet>
</databaseChangeLog>