# this SQL script migrates RefDB reference databases generated with
# version 0.9.4 to the schema used in 0.9.5. Use like this:
#
# mysql -r admin_name -p dbname < migrate_mysql_0.9.5
#
ALTER TABLE t_author MODIFY author_id BIGINT NOT NULL AUTO_INCREMENT;
ALTER TABLE t_keyword MODIFY keyword_id BIGINT NOT NULL AUTO_INCREMENT;
ALTER TABLE t_note MODIFY note_id BIGINT NOT NULL AUTO_INCREMENT, MODIFY note_user_id BIGINT;
ALTER TABLE t_periodical MODIFY periodical_id BIGINT NOT NULL AUTO_INCREMENT;
ALTER TABLE t_refdb MODIFY refdb_id BIGINT NOT NULL AUTO_INCREMENT, MODIFY refdb_periodical_id BIGINT;
ALTER TABLE t_user MODIFY user_id BIGINT NOT NULL AUTO_INCREMENT;
ALTER TABLE t_xauthor MODIFY xauthor_id BIGINT NOT NULL AUTO_INCREMENT, MODIFY author_id BIGINT NOT NULL, MODIFY refdb_id BIGINT NOT NULL;
ALTER TABLE t_xkeyword MODIFY xkeyword_id BIGINT NOT NULL AUTO_INCREMENT, MODIFY keyword_id BIGINT NOT NULL, MODIFY xref_id BIGINT NOT NULL;
ALTER TABLE t_xnote MODIFY xnote_id BIGINT NOT NULL AUTO_INCREMENT, MODIFY note_id BIGINT NOT NULL, MODIFY xref_id BIGINT NOT NULL;
ALTER TABLE t_xuser MODIFY xuser_id BIGINT NOT NULL AUTO_INCREMENT, MODIFY user_id BIGINT NOT NULL, MODIFY refdb_id BIGINT NOT NULL;
