<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE schema SYSTEM "../../dtd/xmlSchema.dtd">

<!--
  * submissions.xml
  *
  * Copyright (c) 2013-2016 Simon Fraser University Library
  * Copyright (c) 2000-2016 John Willinsky
  * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
  *
  * Submission-related schema (e.g. authors) in XML.
  -->

<schema version="0.2">
	<!--
	  *
	  * TABLE authors
	  *
	  -->
	<table name="authors">
		<field name="author_id" type="I8">
			<KEY />
			<AUTOINCREMENT/>
		</field>
		<field name="submission_id" type="I8">
			<NOTNULL/>
		</field>
		<field name="primary_contact" type="I1">
			<NOTNULL/>
			<DEFAULT VALUE="0"/>
		</field>
		<field name="seq" type="F">
			<NOTNULL/>
			<DEFAULT VALUE="0"/>
		</field>
		<field name="first_name" type="C2" size="40">
			<NOTNULL/>
		</field>
		<field name="middle_name" type="C2" size="40"/>
		<field name="last_name" type="C2" size="90">
			<NOTNULL/>
		</field>
		<field name="suffix" type="C2" size="40"/>
		<field name="country" type="C2" size="90"/>
		<field name="email" type="C2" size="90">
			<NOTNULL/>
		</field>
		<field name="url" type="C2" size="255"/>
		<field name="user_group_id" type="I8" />
		<descr>Author metadata for submissions.</descr>
		<index name="authors_submission_id">
			<col>submission_id</col>
		</index>
	</table>

	<!--
	  *
	  * TABLE author_settings
	  *
	  -->
	<table name="author_settings">
		<field name="author_id" type="I8">
			<NOTNULL />
		</field>
		<field name="locale" type="C2" size="5">
			<NOTNULL />
			<DEFAULT VALUE=""/>
		</field>
		<field name="setting_name" type="C2" size="255">
			<NOTNULL />
		</field>
		<field name="setting_value" type="X"/>
		<field name="setting_type" type="C2" size="6">
			<NOTNULL/>
			<descr>(bool|int|float|string|object)</descr>
		</field>
		<descr>Language dependent author metadata.</descr>
		<index name="author_settings_author_id">
			<col>author_id</col>
		</index>
		<index name="author_settings_pkey">
			<col>author_id</col>
			<col>locale</col>
			<col>setting_name</col>
			<UNIQUE/>
		</index>
	</table>	
</schema>
