Custom spells now survive cross zone with their modified spell stats saved to the database for reloading later. The design is such that a spell can be custom defined for its spell stats, but a character/player cannot have more than one of that spell (eg. food can share a spell id since only one food can be applied to you, but you can't have many spells apply using the same custom spell id).
CREATE TABLE character_custom_spell_dataindex (
charid INT UNSIGNED NOT NULL,
spell_id INT UNSIGNED NOT NULL,
idx INT UNSIGNED NOT NULL,
type ENUM('int', 'float', 'bool', 'string') NOT NULL,
value1 TEXT,
value2 TEXT,
PRIMARY KEY (charid, spell_id, idx)
);
CREATE TABLE character_custom_spell_display (
charid INT UNSIGNED NOT NULL,
spell_id INT UNSIGNED NOT NULL,
idx INT UNSIGNED NOT NULL,
field VARCHAR(64) NOT NULL,
value TEXT,
PRIMARY KEY (charid, spell_id, idx, field)
);
CREATE TABLE character_custom_spell_data (
charid INT UNSIGNED NOT NULL,
spell_id INT UNSIGNED NOT NULL,
field VARCHAR(64) NOT NULL,
type ENUM('int', 'float', 'bool', 'string') NOT NULL,
value TEXT NOT NULL,
PRIMARY KEY (charid, spell_id, field)
);