summaryrefslogblamecommitdiff
path: root/src/sql/mysql/updates/update_24_to_25.sql
blob: 8f5ea24eadcc4494ff0db5fc586ecb1c65d080c7 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

















                                                                                                  
START TRANSACTION;

ALTER TABLE mana_inventories ADD COLUMN equipped tinyint(3) unsigned NOT NULL;

INSERT INTO mana_inventories (owner_id, slot, class_id, amount, equipped)
SELECT owner_id, (SELECT IF COUNT(slot) = 0 THEN 1 ELSE MAX(slot) + 1 END IF FROM mana_inventories
        WHERE owner_id=owner_id),
    item_id, 1, 1 FROM mana_char_equips;

DROP TABLE mana_char_equips;

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

COMMIT;