<?xml version="1.0" ?>
<database>
	<name>*dbname*</name>
	<create>true</create>
	<overwrite>false</overwrite>
	<charset>utf8</charset>

	<table>
		<name>*dbprefix*music_artists</name>
		<declaration>
			<field>
				<name>id</name>
				<type>integer</type>
				<notnull>true</notnull>
				<autoincrement>true</autoincrement>
				<unsigned>true</unsigned>
				<primary>true</primary>
			</field>
			<field>
				<name>user_id</name>
				<type>text</type>
				<notnull>true</notnull>
				<length>64</length>
			</field>
			<field>
				<name>name</name>
				<type>text</type>
				<notnull>false</notnull>
				<length>256</length>
			</field>
			<field>
				<name>image</name>
				<type>text</type>
				<notnull>false</notnull>
				<length>256</length>
			</field>
		</declaration>
	</table>

	<table>
		<name>*dbprefix*music_playlists</name>
		<declaration>
			<field>
				<name>id</name>
				<type>integer</type>
				<notnull>true</notnull>
				<autoincrement>true</autoincrement>
				<unsigned>true</unsigned>
				<primary>true</primary>
			</field>
			<field>
				<name>user_id</name>
				<type>text</type>
				<notnull>true</notnull>
				<length>64</length>
			</field>
			<field>
				<name>name</name>
				<type>text</type>
				<notnull>false</notnull>
				<length>256</length>
			</field>
		</declaration>
	</table>

	<table>
		<name>*dbprefix*music_playlist_tracks</name>
		<declaration>
			<field>
				<name>playlist_id</name>
				<type>integer</type>
				<notnull>true</notnull>
				<unsigned>true</unsigned>
			</field>
			<field>
				<name>track_id</name>
				<type>integer</type>
				<notnull>true</notnull>
				<unsigned>true</unsigned>
			</field>
			<index>
				<name>music_playlist_tracks_idx</name>
				<field>
					<name>playlist_id</name>
				</field>
			</index>

			<index>
				<name>music_playlist_tracks_unique_idx</name>
				<unique>true</unique>
				<field>
					<name>playlist_id</name>
				</field>
				<field>
					<name>track_id</name>
				</field>
			</index>
		</declaration>
	</table>

	<table>
		<name>*dbprefix*music_albums</name>
		<declaration>
			<field>
				<name>id</name>
				<type>integer</type>
				<notnull>true</notnull>
				<autoincrement>true</autoincrement>
				<unsigned>true</unsigned>
				<primary>true</primary>
			</field>
			<field>
				<name>user_id</name>
				<type>text</type>
				<notnull>true</notnull>
				<length>64</length>
			</field>
			<field>
				<name>name</name>
				<type>text</type>
				<notnull>false</notnull>
				<length>256</length>
			</field>
			<field>
				<name>year</name>
				<type>integer</type>
				<notnull>false</notnull>
				<unsigned>true</unsigned>
			</field>
			<field>
				<name>cover_file_id</name>
				<type>integer</type>
				<notnull>false</notnull>
				<length>4</length>
				<default></default>
			</field>

			<index>
				<name>ma_cover_file_id_idx</name>
				<field>
					<name>cover_file_id</name>
				</field>
			</index>
		</declaration>
	</table>

	<table>
		<name>*dbprefix*music_album_artists</name>
		<declaration>
			<field>
				<name>artist_id</name>
				<type>integer</type>
				<notnull>false</notnull>
			</field>
			<field>
				<name>album_id</name>
				<type>integer</type>
				<notnull>false</notnull>
			</field>

			<index>
				<name>maa_artist_id_album_id_idx</name>
				<unique>true</unique>
				<field>
					<name>artist_id</name>
				</field>
				<field>
					<name>album_id</name>
				</field>
			</index>
		</declaration>
	</table>

	<table>
		<name>*dbprefix*music_tracks</name>
		<declaration>
			<field>
				<name>id</name>
				<type>integer</type>
				<notnull>true</notnull>
				<autoincrement>true</autoincrement>
				<unsigned>true</unsigned>
				<primary>true</primary>
			</field>
			<field>
				<name>user_id</name>
				<type>text</type>
				<notnull>true</notnull>
				<length>64</length>
			</field>
			<field>
				<name>title</name>
				<type>text</type>
				<notnull>true</notnull>
				<length>256</length>
			</field>
			<field>
				<name>number</name>
				<type>integer</type>
				<notnull>false</notnull>
				<unsigned>true</unsigned>
			</field>
			<field>
				<name>artist_id</name>
				<type>integer</type>
				<notnull>false</notnull>
			</field>
			<field>
				<name>album_id</name>
				<type>integer</type>
				<notnull>false</notnull>
			</field>
			<field>
				<name>length</name>
				<type>integer</type>
				<notnull>false</notnull>
				<unsigned>true</unsigned>
			</field>
			<field>
				<name>file_id</name>
				<type>integer</type>
				<notnull>true</notnull>
				<length>4</length>
			</field>
			<field>
				<name>bitrate</name>
				<type>integer</type>
				<notnull>false</notnull>
				<unsigned>true</unsigned>
			</field>
			<field>
				<name>mimetype</name>
				<type>text</type>
				<notnull>true</notnull>
				<length>256</length>
			</field>

			<index>
				<name>music_tracks_artist_id_idx</name>
				<field>
					<name>artist_id</name>
				</field>
			</index>
			<index>
				<name>music_tracks_album_id_idx</name>
				<field>
					<name>album_id</name>
				</field>
			</index>

			<index>
				<name>music_tracks_file_user_id_idx</name>
				<unique>true</unique>
				<field>
					<name>file_id</name>
				</field>
				<field>
					<name>user_id</name>
				</field>
			</index>
		</declaration>
	</table>

	<table>
		<name>*dbprefix*music_ampache_sessions</name>
		<declaration>
			<field>
				<name>id</name>
				<type>integer</type>
				<notnull>true</notnull>
				<autoincrement>true</autoincrement>
				<unsigned>true</unsigned>
				<primary>true</primary>
			</field>
			<field>
				<name>user_id</name>
				<type>text</type>
				<notnull>true</notnull>
				<length>64</length>
			</field>

			<field>
				<name>token</name>
				<type>text</type>
				<notnull>true</notnull>
				<length>64</length>
			</field>

			<field>
				<name>expiry</name>
				<type>integer</type>
				<notnull>true</notnull>
				<unsigned>true</unsigned>
			</field>

			<index>
				<name>music_ampache_sessions_index</name>
				<unique>true</unique>
				<field>
					<name>token</name>
				</field>
			</index>
		</declaration>
	</table>

	<table>
		<name>*dbprefix*music_ampache_users</name>
		<declaration>
			<field>
				<name>id</name>
				<type>integer</type>
				<default>0</default>
				<notnull>true</notnull>
				<autoincrement>1</autoincrement>
				<length>4</length>
			</field>

			<field>
				<name>user_id</name>
				<type>text</type>
				<notnull>true</notnull>
				<length>64</length>
			</field>

			<field>
				<name>description</name>
				<type>text</type>
				<length>64</length>
			</field>

			<field>
				<name>hash</name>
				<type>text</type>
				<notnull>true</notnull>
				<length>64</length>
			</field>

			<index>
				<name>music_ampache_users_index</name>
				<unique>true</unique>
				<field>
					<name>hash</name>
				</field>
				<field>
					<name>user_id</name>
				</field>
			</index>
		</declaration>
	</table>

</database>
