CREATE TABLE user_cost_centres (
	service_number INT NOT NULL,
	cost_centre SMALLINT UNSIGNED NOT NULL,
	PRIMARY KEY (service_number, cost_centre),
	FOREIGN KEY fk_service_number (service_number) REFERENCES users (service_number)
) ENGINE=InnoDB;

INSERT INTO user_cost_centres (service_number, cost_centre)
	SELECT u.service_number, u.cost_centre FROM users u WHERE u.cost_centre IS NOT NULL;

ALTER TABLE users DROP COLUMN cost_centre;
