PRAGMA foreign_keys = 0;

ALTER TABLE GameInfo ADD FeeGolds INT NOT NULL
DEFAULT 0;

ALTER TABLE GameInfo ADD FeeDiamonds INT NOT NULL
DEFAULT 0;

ALTER TABLE GameInfo ADD IsAcceptGolds BOOLEAN NOT NULL
DEFAULT true;

ALTER TABLE GameInfo ADD ResConsumption INT NOT NULL
  DEFAULT 50;

UPDATE GameInfo
   SET FeeGolds = Price;

CREATE TABLE sqlitestudio_temp_table AS SELECT *
                                          FROM GameInfo;

DROP TABLE GameInfo;

CREATE TABLE GameInfo (
    Name          VARCHAR PRIMARY KEY,
    Console       VARCHAR NOT NULL,
    Type          VARCHAR NOT NULL,
    IsIndie       BOOLEAN NOT NULL,
    IsMMO         BOOLEAN NOT NULL,
    Location      VARCHAR,
    WorkerConfig  VARCHAR,
    MaxPlayers    INT     NOT NULL,
    WorkDirectory VARCHAR,
    Command       VARCHAR,
    MultiRun      BOOLEAN NOT NULL,
    IsPublic      INT     NOT NULL,
    IsAcceptGolds BOOLEAN NOT NULL,
    FeeGolds      INT     NOT NULL,
    FeeDiamonds   INT     NOT NULL,
    Width         INT     NOT NULL,
    Height        INT     NOT NULL,
    ResConsumption INT NOT NULL,
    Nullity       BOOLEAN
);

INSERT INTO GameInfo (
                         Name,
                         Console,
                         Type,
                         IsIndie,
                         IsMMO,
                         Location,
                         WorkerConfig,
                         MaxPlayers,
                         WorkDirectory,
                         Command,
                         MultiRun,
                         IsPublic,
                         IsAcceptGolds,
                         FeeGolds,
                         FeeDiamonds,
                         Width,
                         Height,
	         ResConsumption,
                         Nullity
                     )
                     SELECT Name,
                            Console,
                            Type,
                            IsIndie,
                            IsMMO,
                            Location,
                            WorkerConfig,
                            MaxPlayers,
                            WorkDirectory,
                            Command,
                            MultiRun,
                            IsPublic,
                            IsAcceptGolds,
                            FeeGolds,
                            FeeDiamonds,
                            Width,
                            Height,
	            ResConsumption,
                            Nullity
                       FROM sqlitestudio_temp_table;

DROP TABLE sqlitestudio_temp_table;

PRAGMA foreign_keys = 1;
