##----system_constant_dat create

DROP TABLE IF EXISTS system_constant_dat;
CREATE TABLE IF NOT EXISTS system_constant_dat(
	id bigint unsigned NOT NULL PRIMARY KEY auto_increment,
	registration_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	name varchar(64) NOT NULL,
	title varchar(128) NOT NULL,
	constant_value text NOT NULL,
	delete_flg tinyint(1) NOT NULL DEFAULT '0'
) ENGINE = INNODB DEFAULT CHARSET=utf8mb4;

Create INDEX system_constant_dat_name_idx ON system_constant_dat(name);


##----government_mst create

DROP TABLE IF EXISTS government_mst;
CREATE TABLE IF NOT EXISTS government_mst(
	id bigint unsigned NOT NULL PRIMARY KEY auto_increment,
	registration_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	province varchar(64) NOT NULL,
	city varchar(64),
	district varchar(64),
	title text NOT NULL,
	delete_flg tinyint(1) NOT NULL DEFAULT '0'
) ENGINE = INNODB DEFAULT CHARSET=utf8mb4;

Create INDEX government_mst_province_idx ON government_mst(province);
Create INDEX government_mst_city_idx ON government_mst(city);
Create INDEX government_mst_district_idx ON government_mst(district);


##----government_qr_dat create

DROP TABLE IF EXISTS government_qr_dat;
CREATE TABLE IF NOT EXISTS government_qr_dat(
	id bigint unsigned NOT NULL PRIMARY KEY auto_increment,
	registration_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	government_id int8 NOT NULL,
	province varchar(64) NOT NULL,
	city varchar(64),
	district varchar(64),
	qr_image text NOT NULL,
	use_count int8 NOT NULL DEFAULT '0',
	max_count int8 NOT NULL DEFAULT '0',
	limit_date varchar(10) NOT NULL,
	title text NOT NULL,
	delete_flg tinyint(1) NOT NULL DEFAULT '0'
) ENGINE = INNODB DEFAULT CHARSET=utf8mb4;

Create INDEX government_qr_dat_id_idx ON government_qr_dat(id);
Create INDEX government_qr_dat_province_idx ON government_qr_dat(province);
Create INDEX government_qr_dat_city_idx ON government_qr_dat(city);
Create INDEX government_qr_dat_district_idx ON government_qr_dat(district);


##----account_mst create

DROP TABLE IF EXISTS account_mst;
CREATE TABLE IF NOT EXISTS account_mst(
	id bigint unsigned NOT NULL PRIMARY KEY auto_increment,
	registration_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	login text NOT NULL,
	password text NOT NULL,
	name varchar(64) NOT NULL,
	contact text,
	role varchar(128) NOT NULL,
	user_id int8 NOT NULL DEFAULT '0',
	school_id int8 NOT NULL DEFAULT '0',
	government_id int8 NOT NULL DEFAULT '0',
	modules text NOT NULL,
	comment text,
	delete_flg tinyint(1) NOT NULL DEFAULT '0'
) ENGINE = INNODB DEFAULT CHARSET=utf8mb4;

Create INDEX account_mst_login_idx ON account_mst(login(255));
Create INDEX account_mst_password_idx ON account_mst(password(255));
Create INDEX account_mst_name_idx ON account_mst(name);


##----school_mst create

DROP TABLE IF EXISTS school_mst;
CREATE TABLE IF NOT EXISTS school_mst(
	id bigint unsigned NOT NULL PRIMARY KEY auto_increment,
	registration_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	school_no varchar(64) NOT NULL,
	original_source int8 NOT NULL DEFAULT '0',
	title text NOT NULL,
	school_type varchar(64) NOT NULL,
	front_image text,
	comment text,
	address text,
	province varchar(64),
	city varchar(64),
	district varchar(64),
	street text,
	longitude text,
	latitude text,
	delete_flg tinyint(1) NOT NULL DEFAULT '0'
) ENGINE = INNODB DEFAULT CHARSET=utf8mb4;

Create INDEX school_mst_id_idx ON school_mst(id);
Create INDEX school_mst_school_type_idx ON school_mst(school_type);
Create INDEX school_mst_province_idx ON school_mst(province);
Create INDEX school_mst_city_idx ON school_mst(city);


##----grade_mst create

DROP TABLE IF EXISTS grade_mst;
CREATE TABLE IF NOT EXISTS grade_mst(
	id bigint unsigned NOT NULL PRIMARY KEY auto_increment,
	registration_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	school_id int8 NOT NULL,
	school_no varchar(64) NOT NULL,
	original_source int8 NOT NULL DEFAULT '0',
	title text NOT NULL,
	delete_flg tinyint(1) NOT NULL DEFAULT '0'
) ENGINE = INNODB DEFAULT CHARSET=utf8mb4;

Create INDEX grade_mst_school_id_idx ON grade_mst(school_id);


##----class_mst create

DROP TABLE IF EXISTS class_mst;
CREATE TABLE IF NOT EXISTS class_mst(
	id bigint unsigned NOT NULL PRIMARY KEY auto_increment,
	registration_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	school_id int8 NOT NULL,
	school_no varchar(64) NOT NULL,
	class_no varchar(64) NOT NULL,
	original_source int8 NOT NULL DEFAULT '0',
	grade_id int8 NOT NULL,
	title text NOT NULL,
	member_count int8 NOT NULL DEFAULT '0',
	delete_flg tinyint(1) NOT NULL DEFAULT '0'
) ENGINE = INNODB DEFAULT CHARSET=utf8mb4;

Create INDEX class_mst_school_id_idx ON class_mst(school_id);
Create INDEX class_mst_grade_id_idx ON class_mst(grade_id);
Create INDEX class_mst_class_no_idx ON class_mst(class_no);


##----circle_dat create

DROP TABLE IF EXISTS circle_dat;
CREATE TABLE IF NOT EXISTS circle_dat(
	id bigint unsigned NOT NULL PRIMARY KEY auto_increment,
	registration_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	title varchar(64) NOT NULL,
	member_count int8 NOT NULL DEFAULT '0',
	need_check tinyint(1) NOT NULL DEFAULT '0',
	front_image text,
	comment text,
	longitude text NOT NULL,
	latitude text NOT NULL,
	province varchar(64) NOT NULL,
	city varchar(64) NOT NULL,
	district varchar(64) NOT NULL,
	owner_id int8 NOT NULL DEFAULT '0',
	delete_flg tinyint(1) NOT NULL DEFAULT '0'
) ENGINE = INNODB DEFAULT CHARSET=utf8mb4;

Create INDEX circle_dat_title_idx ON circle_dat(title);
Create INDEX circle_dat_owner_id_idx ON circle_dat(owner_id);


##----circle_notice_dat create

DROP TABLE IF EXISTS circle_notice_dat;
CREATE TABLE IF NOT EXISTS circle_notice_dat(
	id bigint unsigned NOT NULL PRIMARY KEY auto_increment,
	registration_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	circle_id int8 NOT NULL DEFAULT '0',
	title varchar(128) NOT NULL,
	comment text,
	image text,
	delete_flg tinyint(1) NOT NULL DEFAULT '0'
) ENGINE = INNODB DEFAULT CHARSET=utf8mb4;

Create INDEX circle_notice_dat_circle_id_idx ON circle_notice_dat(circle_id);


##----circle_member_dat create

DROP TABLE IF EXISTS circle_member_dat;
CREATE TABLE IF NOT EXISTS circle_member_dat(
	id bigint unsigned NOT NULL PRIMARY KEY auto_increment,
	registration_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	circle_id int8 NOT NULL DEFAULT '0',
	user_id int8 NOT NULL DEFAULT '0',
	name varchar(64),
	delete_flg tinyint(1) NOT NULL DEFAULT '0'
) ENGINE = INNODB DEFAULT CHARSET=utf8mb4;

Create INDEX circle_member_dat_circle_id_idx ON circle_member_dat(circle_id);
Create INDEX circle_member_dat_user_id_idx ON circle_member_dat(user_id);


##----user_mst create

DROP TABLE IF EXISTS user_mst;
CREATE TABLE IF NOT EXISTS user_mst(
	id bigint unsigned NOT NULL PRIMARY KEY auto_increment,
	registration_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	school_no varchar(64) NOT NULL DEFAULT '0',
	class_no varchar(64) NOT NULL DEFAULT '0',
	original_source int8 NOT NULL DEFAULT '0',
	openid varchar(64) NOT NULL,
	unionid varchar(64) NOT NULL,
	name varchar(64),
	header_img text,
	mobile varchar(32),
	account_id int8 NOT NULL DEFAULT '0',
	child_age int8 NOT NULL DEFAULT '1',
	role int8 NOT NULL DEFAULT '0',
	school_owner tinyint(1) NOT NULL DEFAULT '0',
	class_owner tinyint(1) NOT NULL DEFAULT '0',
	longitude text,
	latitude text,
	government_id int8 NOT NULL DEFAULT '0',
	province varchar(64),
	city varchar(64),
	district varchar(64),
	organization_submit_date timestamp,
	organization_no varchar(255),
	organization_title text,
	legal_person varchar(255),
	organization_contact text,
	legal_person_imgage1 text,
	legal_person_imgage2 text,
	licensen_imgage text,
	other_imgage text,
	organization_status varchar(64) NOT NULL DEFAULT 'NEW',
	is_member tinyint(1) NOT NULL DEFAULT '0'
	ability_point int8 NOT NULL DEFAULT '0',
	service_point int8 NOT NULL DEFAULT '0',
	delete_flg tinyint(1) NOT NULL DEFAULT '0'
) ENGINE = INNODB DEFAULT CHARSET=utf8mb4;

Create INDEX user_mst_school_no_idx ON user_mst(school_no);
Create INDEX user_mst_class_no_idx ON user_mst(class_no);
Create INDEX user_mst_openid_idx ON user_mst(openid);
Create INDEX user_mst_unionid_idx ON user_mst(unionid);


##----user_message_dat create

DROP TABLE IF EXISTS user_message_dat;
CREATE TABLE IF NOT EXISTS user_message_dat(
	id bigint unsigned NOT NULL PRIMARY KEY auto_increment,
	registration_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	user_id int8 NOT NULL DEFAULT '0',
	title varchar(128) NOT NULL,
	comment text,
	attach_dat_type text,
	attach_dat_id int8 NOT NULL DEFAULT '0',
	attach_dat_path text,
	is_read tinyint(1) NOT NULL DEFAULT '0',
	delete_flg tinyint(1) NOT NULL DEFAULT '0'
) ENGINE = INNODB DEFAULT CHARSET=utf8mb4;

Create INDEX user_message_dat_user_id_idx ON user_message_dat(user_id);


##----social_event_dat create

DROP TABLE IF EXISTS social_event_dat;
CREATE TABLE IF NOT EXISTS social_event_dat(
	id bigint unsigned NOT NULL PRIMARY KEY auto_increment,
	registration_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	school_no varchar(64) NOT NULL,
	class_no varchar(64) NOT NULL,
	event_id int8 NOT NULL,
	original_source int8 NOT NULL DEFAULT '0',
	title text NOT NULL,
	author text NOT NULL,
	publish_time timestamp NOT NULL,
	images text,
	content text NOT NULL,
	delete_flg tinyint(1) NOT NULL DEFAULT '0'
) ENGINE = INNODB DEFAULT CHARSET=utf8mb4;

Create INDEX social_event_dat_school_no_idx ON social_event_dat(school_no);
Create INDEX social_event_dat_class_no_idx ON social_event_dat(class_no);
Create INDEX social_event_dat_original_source_idx ON social_event_dat(original_source);


##----social_event_member_dat create

DROP TABLE IF EXISTS social_event_member_dat;
CREATE TABLE IF NOT EXISTS social_event_member_dat(
	id bigint unsigned NOT NULL PRIMARY KEY auto_increment,
	registration_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	social_event_id int8 NOT NULL,
	user_id int8 NOT NULL,
	comment text NOT NULL,
	images text NOT NULL,
	status varchar(64) NOT NULL DEFAULT '0',
	point int8 NOT NULL DEFAULT '0',
	delete_flg tinyint(1) NOT NULL DEFAULT '0'
) ENGINE = INNODB DEFAULT CHARSET=utf8mb4;

Create INDEX social_event_member_dat_user_id_idx ON social_event_member_dat(user_id);
Create INDEX social_event_member_dat_social_event_id_idx ON social_event_member_dat(social_event_id);


##----family_event_dat create

DROP TABLE IF EXISTS family_event_dat;
CREATE TABLE IF NOT EXISTS family_event_dat(
	id bigint unsigned NOT NULL PRIMARY KEY auto_increment,
	registration_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	school_no varchar(64) NOT NULL,
	class_no varchar(64) NOT NULL,
	event_id int8 NOT NULL,
	original_source int8 NOT NULL DEFAULT '0',
	title text NOT NULL,
	author text NOT NULL,
	publish_time timestamp NOT NULL,
	images text,
	content text NOT NULL,
	delete_flg tinyint(1) NOT NULL DEFAULT '0'
) ENGINE = INNODB DEFAULT CHARSET=utf8mb4;

Create INDEX family_event_dat_school_no_idx ON family_event_dat(school_no);
Create INDEX family_event_dat_class_no_idx ON family_event_dat(class_no);
Create INDEX family_event_dat_original_source_idx ON family_event_dat(original_source);


##----family_event_member_dat create

DROP TABLE IF EXISTS family_event_member_dat;
CREATE TABLE IF NOT EXISTS family_event_member_dat(
	id bigint unsigned NOT NULL PRIMARY KEY auto_increment,
	registration_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	family_event_id int8 NOT NULL,
	user_id int8 NOT NULL,
	comment text NOT NULL,
	images text NOT NULL,
	status varchar(64) NOT NULL DEFAULT '0',
	point int8 NOT NULL DEFAULT '0',
	delete_flg tinyint(1) NOT NULL DEFAULT '0'
) ENGINE = INNODB DEFAULT CHARSET=utf8mb4;

Create INDEX family_event_member_dat_user_id_idx ON family_event_member_dat(user_id);
Create INDEX family_event_member_dat_family_event_id_idx ON family_event_member_dat(family_event_id);


##----volunteer_event_member_dat create

DROP TABLE IF EXISTS volunteer_event_member_dat;
CREATE TABLE IF NOT EXISTS volunteer_event_member_dat(
	id bigint unsigned NOT NULL PRIMARY KEY auto_increment,
	registration_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	volunteer_event_id int8 NOT NULL,
	index_no varchar(5) NOT NULL,
	user_id int8 NOT NULL,
	circle_id int8 NOT NULL DEFAULT '0',
	is_owner tinyint(1) NOT NULL DEFAULT '0',
	mobile varchar(32) NOT NULL,
	comment text,
	images text,
	position text,
	position_longitude text,
	position_latitude text,
	role int8 NOT NULL DEFAULT '0',
	time_length float(6,2) NOT NULL DEFAULT '0',
	finish_time timestamp,
	status varchar(64) NOT NULL DEFAULT 'NEW',
	delete_flg tinyint(1) NOT NULL DEFAULT '0'
) ENGINE = INNODB DEFAULT CHARSET=utf8mb4;

Create INDEX volunteer_event_member_dat_volunteer_event_id_idx ON volunteer_event_member_dat(volunteer_event_id);
Create INDEX volunteer_event_member_dat_user_id_idx ON volunteer_event_member_dat(user_id);
Create INDEX volunteer_event_member_dat_circle_id_idx ON volunteer_event_member_dat(circle_id);


##----volunteer_event_dat create

DROP TABLE IF EXISTS volunteer_event_dat;
CREATE TABLE IF NOT EXISTS volunteer_event_dat(
	id bigint unsigned NOT NULL PRIMARY KEY auto_increment,
	registration_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	title text NOT NULL,
	comment text NOT NULL,
	start_time timestamp NOT NULL,
	finish_time timestamp NOT NULL,
	enroll_time timestamp NOT NULL,
	front_image text NOT NULL,
	position text NOT NULL,
	position_longitude text NOT NULL,
	position_latitude text NOT NULL,
	account_id int8 NOT NULL DEFAULT '0',
	circle_id int8 NOT NULL DEFAULT '0',
	author varchar(64) NOT NULL,
	author_role int8 NOT NULL DEFAULT '0',
	auditor_id int8,
	auditor_name varchar(64),
	school_no varchar(64) NOT NULL DEFAULT '0',
	original_source int8 NOT NULL DEFAULT '0',
	province varchar(64),
	city varchar(64),
	district varchar(64),
	include_social_user tinyint(1) NOT NULL DEFAULT '0',
	max_member int8 NOT NULL DEFAULT '0',
	member_count int8 NOT NULL DEFAULT '0',
	time_length varchar(64) NOT NULL,
	leader_name varchar(64) NOT NULL,
	leader_contact varchar(128) NOT NULL,
	venue text NOT NULL,
	venue_time timestamp NOT NULL,
	status varchar(64) NOT NULL DEFAULT 'NEW',
	delete_flg tinyint(1) NOT NULL DEFAULT '0'
) ENGINE = INNODB DEFAULT CHARSET=utf8mb4;

Create INDEX volunteer_event_dat_id_idx ON volunteer_event_dat(id);


##----user_certificate_dat create

DROP TABLE IF EXISTS user_certificate_dat;
CREATE TABLE IF NOT EXISTS user_certificate_dat(
	id bigint unsigned NOT NULL PRIMARY KEY auto_increment,
	registration_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	user_id int8 NOT NULL,
	certificate_id int8 NOT NULL,
	name varchar(64) NOT NULL,
	mobile varchar(32) NOT NULL,
	address varchar(128) NOT NULL,
	status varchar(64) NOT NULL DEFAULT '0',
	delete_flg tinyint(1) NOT NULL DEFAULT '0'
) ENGINE = INNODB DEFAULT CHARSET=utf8mb4;

Create INDEX user_certificate_dat_user_id_idx ON user_certificate_dat(user_id);
Create INDEX user_certificate_dat_certificate_id_idx ON user_certificate_dat(certificate_id);


##----certificate_mst create

DROP TABLE IF EXISTS certificate_mst;
CREATE TABLE IF NOT EXISTS certificate_mst(
	id bigint unsigned NOT NULL PRIMARY KEY auto_increment,
	registration_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	title varchar(128) NOT NULL,
	front_image text NOT NULL,
	display_order int8 NOT NULL DEFAULT '1',
	delete_flg tinyint(1) NOT NULL DEFAULT '0'
) ENGINE = INNODB DEFAULT CHARSET=utf8mb4;

Create INDEX certificate_mst_id_idx ON certificate_mst(id);


##----user_pay_log create

DROP TABLE IF EXISTS user_pay_log;
CREATE TABLE IF NOT EXISTS user_pay_log(
	id bigint unsigned NOT NULL PRIMARY KEY auto_increment,
	registration_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	user_id int8 NOT NULL,
	user_name varchar(64) NOT NULL,
	action_type varchar(32) NOT NULL,
	money float(5,2) NOT NULL DEFAULT '0',
	delete_flg tinyint(1) NOT NULL DEFAULT '0'
) ENGINE = INNODB DEFAULT CHARSET=utf8mb4;

Create INDEX user_pay_log_user_id_idx ON user_pay_log(user_id);
Create INDEX user_pay_log_action_type_idx ON user_pay_log(action_type);


##----course_media_dat create

DROP TABLE IF EXISTS course_media_dat;
CREATE TABLE IF NOT EXISTS course_media_dat(
	id bigint unsigned NOT NULL PRIMARY KEY auto_increment,
	registration_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	course_id int8 NOT NULL DEFAULT '0',
	parent_category_id int8 NOT NULL EFAULT '0',
	sub_category_id int8 NOT NULL EFAULT '0',
	title varchar(128) NOT NULL,
	comment text NOT NULL,
	tags text NOT NULL,
	front_image text NOT NULL,
	media text NOT NULL,
	size int8 NOT NULL DEFAULT '0',
	teacher varchar(128),
	teacher_profile text,
	is_free tinyint(1) NOT NULL DEFAULT '0',
	price float(5,2) NOT NULL DEFAULT '0',
	view_count int8 NOT NULL DEFAULT '0',
	delete_flg tinyint(1) NOT NULL DEFAULT '0'
) ENGINE = INNODB DEFAULT CHARSET=utf8mb4;

Create INDEX course_media_dat_course_id_idx ON course_media_dat(course_id);


##----media_tag_dat create

DROP TABLE IF EXISTS media_tag_dat;
CREATE TABLE IF NOT EXISTS media_tag_dat(
	id bigint unsigned NOT NULL PRIMARY KEY auto_increment,
	registration_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	tag varchar(128) NOT NULL,
	delete_flg tinyint(1) NOT NULL DEFAULT '0'
) ENGINE = INNODB DEFAULT CHARSET=utf8mb4;

Create INDEX media_tag_dat_tag_idx ON media_tag_dat(tag);


##----course_category_dat create

DROP TABLE IF EXISTS course_category_dat;
CREATE TABLE IF NOT EXISTS course_category_dat(
	id bigint unsigned NOT NULL PRIMARY KEY auto_increment,
	registration_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	parent_id int4 NOT NULL,
	title varchar(128) NOT NULL,
	delete_flg tinyint(1) NOT NULL DEFAULT '0'
) ENGINE = INNODB DEFAULT CHARSET=utf8mb4;

Create INDEX course_category_dat_id_idx ON course_category_dat(id);
Create INDEX course_category_dat_parent_id_idx ON course_category_dat(parent_id);


##----course_mst create

DROP TABLE IF EXISTS course_mst;
CREATE TABLE IF NOT EXISTS course_mst(
	id bigint unsigned NOT NULL PRIMARY KEY auto_increment,
	registration_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	parent_category_id int8 NOT NULL,
	sub_category_id int8 NOT NULL,
	title varchar(128) NOT NULL,
	comment text NOT NULL,
	front_image text NOT NULL,
	teacher_name varchar(128) NOT NULL,
	teacher_profile text,
	media_count int4 NOT NULL DEFAULT '0',
	delete_flg tinyint(1) NOT NULL DEFAULT '0'
) ENGINE = INNODB DEFAULT CHARSET=utf8mb4;

Create INDEX course_mst_id_idx ON course_mst(id);
Create INDEX course_mst_title_idx ON course_mst(title);


##----user_media_dat create

DROP TABLE IF EXISTS user_media_dat;
CREATE TABLE IF NOT EXISTS user_media_dat(
	id bigint unsigned NOT NULL PRIMARY KEY auto_increment,
	registration_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	user_id int8 NOT NULL,
	course_id int8 NOT NULL,
	media_id int8 NOT NULL,
	is_free tinyint(1) NOT NULL DEFAULT '0',
	money float(5,2) NOT NULL DEFAULT '0',
	order_no varchar(255),
	mchid_order_no varchar(255),
	status varchar(64),
	delete_flg tinyint(1) NOT NULL DEFAULT '0'
) ENGINE = INNODB DEFAULT CHARSET=utf8mb4;

Create INDEX user_media_dat_user_id_idx ON user_media_dat(user_id);
Create INDEX user_media_dat_course_id_idx ON user_media_dat(course_id);
Create INDEX user_media_dat_media_id_idx ON user_media_dat(media_id);


##----donations_event_dat create

DROP TABLE IF EXISTS donations_event_dat;
CREATE TABLE IF NOT EXISTS donations_event_dat(
	id bigint unsigned NOT NULL PRIMARY KEY auto_increment,
	registration_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	title text NOT NULL,
	comment text NOT NULL,
	start_time timestamp NOT NULL,
	finish_time timestamp NOT NULL,
	front_image text NOT NULL,
	author varchar(64) NOT NULL,
	author_role int8 NOT NULL DEFAULT '0',
	auditor_id int8,
	auditor_name varchar(64),
	max_money float(10,2) NOT NULL DEFAULT '0',
	money float(10,2) NOT NULL DEFAULT '0',
	status varchar(64) NOT NULL,
	delete_flg tinyint(1) NOT NULL DEFAULT '0'
) ENGINE = INNODB DEFAULT CHARSET=utf8mb4;

Create INDEX donations_event_dat_id_idx ON donations_event_dat(id);


##----user_donation_dat create

DROP TABLE IF EXISTS user_donation_dat;
CREATE TABLE IF NOT EXISTS user_donation_dat(
	id bigint unsigned NOT NULL PRIMARY KEY auto_increment,
	registration_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	user_id int8 NOT NULL,
	donation_id int8 NOT NULL,
	comment text,
	money float(5,2) NOT NULL DEFAULT '0',
	order_no varchar(255),
	mchid_order_no varchar(255),
	status varchar(64),
	delete_flg tinyint(1) NOT NULL DEFAULT '0'
) ENGINE = INNODB DEFAULT CHARSET=utf8mb4;

Create INDEX user_donation_dat_user_id_idx ON user_donation_dat(user_id);
Create INDEX user_donation_dat_donation_id_idx ON user_donation_dat(donation_id);


