summaryrefslogtreecommitdiff
path: root/src/sql/mysql/updates/update_21_to_22.sql
blob: 88c6f8c21a13ed123ffc4484767f14656640810b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
START TRANSACTION;

CREATE TABLE mana_char_abilities
(
    `char_id`                int(10) unsigned NOT NULL,
    `ability_id`             int(10) unsigned NOT NULL,
    `ability_current_points` int(10) unsigned NOT NULL,
    PRIMARY KEY (`char_id`, `ability_id`),
    FOREIGN KEY (`char_id`)
        REFERENCES `mana_characters` (`id`)
        ON DELETE CASCADE
) ENGINE=InnoDB
DEFAULT CHARSET=utf8;

INSERT INTO mana_char_abilities (char_id, ability_id, ability_current_points)
    SELECT char_id, special_id, special_current_mana FROM mana_char_specials;

DROP TABLE mana_char_specials;

-- Update database version.
UPDATE mana_world_states
    SET value = '22',
        moddate = UNIX_TIMESTAMP()
    WHERE state_name = 'database_version';

COMMIT;