----account_mst
DROP TABLE IF EXISTS account_mst;
CREATE TABLE IF NOT EXISTS account_mst(
	id int8 unsigned NOT NULL PRIMARY KEY auto_increment,
	registration_date datetime 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,
	authority_level text NOT NULL,
	comment text,
	delete_flg tinyint(1) NOT NULL DEFAULT '0'
) ENGINE = INNODB DEFAULT CHARSET=utf8;
Create INDEX account_mst_name_idx ON account_mst(name);

----grade_mst
DROP TABLE IF EXISTS grade_mst;
CREATE TABLE IF NOT EXISTS grade_mst(
	id int8 unsigned NOT NULL PRIMARY KEY auto_increment,
	registration_date datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
	school_id int8 NOT NULL,
	title text NOT NULL,
	delete_flg tinyint(1) NOT NULL DEFAULT '0'
) ENGINE = INNODB DEFAULT CHARSET=utf8;
Create INDEX grade_mst_school_id_idx ON grade_mst(school_id);

----class_mst
DROP TABLE IF EXISTS class_mst;
CREATE TABLE IF NOT EXISTS class_mst(
	id int8 unsigned NOT NULL PRIMARY KEY auto_increment,
	registration_date datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
	school_id int8 NOT NULL,
	grade_id int8 NOT NULL,
	class_no varchar(64) NOT NULL,
	title text NOT NULL,
	member_count int8 NOT NULL,
	manager_id int8 NOT NULL,
	delete_flg tinyint(1) NOT NULL DEFAULT '0'
) ENGINE = INNODB DEFAULT CHARSET=utf8;
Create INDEX grade_mst_school_id_idx ON class_mst(school_id);
Create INDEX grade_mst_grade_id_idx ON class_mst(grade_id);
Create INDEX grade_mst_class_no_idx ON class_mst(class_no);


----organization_mst
DROP TABLE IF EXISTS organization_mst;
CREATE TABLE IF NOT EXISTS organization_mst(
	id int8 unsigned NOT NULL PRIMARY KEY auto_increment,
	registration_date datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
	submit_date datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
	organization_no varchar(255) NOT NULL,
	title text NOT NULL,
	legal_person varchar(255) NOT NULL,
	contact text NOT NULL,
	legal_person_imgage1 varchar(255) NOT NULL,
	legal_person_imgage2 varchar(255) NOT NULL,
	licensen_imgage varchar(255) NOT NULL,
	other_imgage varchar(255),
	status varchar(255) NOT NULL DEFAULT 'NEW',
	delete_flg tinyint(1) NOT NULL DEFAULT '0'
) ENGINE = INNODB DEFAULT CHARSET=utf8;
Create INDEX grade_mst_id_idx ON organization_mst(id);
Create INDEX grade_mst_submit_date_idx ON organization_mst(submit_date);
Create INDEX grade_mst_status_idx ON organization_mst(status);

