• 0
agentGoonie

Will there still be upgrade scripts?

Question

8 answers to this question

  • 0

Someone from the community will likely provide this soon. At least, I hope. I think I could do it but I'm still learning how to do stuff with SQL so I'd rather trust someone who knew what they were doing 100%.

Share this post


Link to post
Share on other sites
Advertisement
  • 0

done

Spoiler

ALTER TABLE `account`
  CHANGE COLUMN `first_connect_at` `first_connect_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
  CHANGE COLUMN `last_connect_at` `last_connect_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP

ALTER TABLE `clan`
  CHANGE COLUMN `created_at` `created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP

ALTER TABLE `construction`
  CHANGE COLUMN `spawned_at` `spawned_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP AFTER `account_uid`,
  CHANGE COLUMN `position_x` `position_x` DOUBLE NULL DEFAULT '0' AFTER `spawned_at`,
  CHANGE COLUMN `position_y` `position_y` DOUBLE NULL DEFAULT '0' AFTER `position_x`,
  CHANGE COLUMN `position_z` `position_z` DOUBLE NULL DEFAULT '0' AFTER `position_y`,
  CHANGE COLUMN `direction_x` `direction_x` DOUBLE NULL DEFAULT '0' AFTER `position_z`,
  CHANGE COLUMN `direction_y` `direction_y` DOUBLE NULL DEFAULT '0' AFTER `direction_x`,
  CHANGE COLUMN `direction_z` `direction_z` DOUBLE NULL DEFAULT '0' AFTER `direction_y`,
  CHANGE COLUMN `up_x` `up_x` DOUBLE NULL DEFAULT '0' AFTER `direction_z`,
  CHANGE COLUMN `up_y` `up_y` DOUBLE NULL DEFAULT '0' AFTER `up_x`,
  CHANGE COLUMN `up_z` `up_z` DOUBLE NULL DEFAULT '0' AFTER `up_y`,
  CHANGE COLUMN `is_locked` `is_locked` TINYINT(1) NULL DEFAULT '0' AFTER `up_z`,
  CHANGE COLUMN `pin_code` `pin_code` VARCHAR(6) NOT NULL DEFAULT '000000' AFTER `is_locked`,
  ADD COLUMN `territory_id` INT(11) UNSIGNED NULL DEFAULT NULL AFTER `pin_code`,
  ADD COLUMN `last_updated_at` DATETIME NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP AFTER `territory_id`,
  DROP COLUMN `maintained_at`;

ALTER TABLE `container`
  CHANGE COLUMN `spawned_at` `spawned_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  DROP COLUMN `last_accessed`,
  ADD COLUMN `last_updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  ADD COLUMN `territory_id` int(11) UNSIGNED DEFAULT NULL;


ALTER TABLE `player` 
  DROP COLUMN `is_alive`,
  CHANGE COLUMN `damage` `damage` double UNSIGNED NOT NULL DEFAULT '0',
  DROP COLUMN `fatigue`,
  CHANGE COLUMN `hunger` `hunger` double UNSIGNED NOT NULL DEFAULT '100',
  CHANGE COLUMN `thirst` `thirst` double UNSIGNED NOT NULL DEFAULT '100',
  CHANGE COLUMN `alcohol` `alcohol` double UNSIGNED NOT NULL DEFAULT '0',
  CHANGE COLUMN `oxygen_remaining` `oxygen_remaining` double UNSIGNED NOT NULL DEFAULT '1',
  CHANGE COLUMN `bleeding_remaining` `bleeding_remaining` double UNSIGNED NOT NULL DEFAULT '0',
  CHANGE COLUMN `spawned_at` `spawned_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  ADD COLUMN `hitpoints` varchar(255) NOT NULL DEFAULT '[]',
  DROP COLUMN `hitpoint_head`,
  DROP COLUMN `hitpoint_body`,
  DROP COLUMN `hitpoint_hands`,
  DROP COLUMN `hitpoint_legs`,
  DROP COLUMN `died_at`,
  ADD COLUMN `last_updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;

ALTER TABLE `territory`
  CHANGE COLUMN `created_at` `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  CHANGE COLUMN `last_paid_at` `last_paid_at` datetime DEFAULT CURRENT_TIMESTAMP;

ALTER TABLE `vehicles`
  CHANGE COLUMN `spawned_at` `spawned_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  ADD COLUMN `last_updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;

CREATE TABLE `player_history` (
  `id` int(11) UNSIGNED NOT NULL,
  `account_uid` varchar(32) NOT NULL,
  `name` varchar(64) NOT NULL,
  `died_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `position_x` double NOT NULL,
  `position_y` double NOT NULL,
  `position_z` double NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



ALTER TABLE `account`
  ADD PRIMARY KEY (`uid`),
  ADD KEY `clan_id` (`clan_id`);

ALTER TABLE `clan`
  ADD PRIMARY KEY (`id`),
  ADD KEY `leader_uid` (`leader_uid`);

ALTER TABLE `construction`
  ADD PRIMARY KEY (`id`),
  ADD KEY `account_uid` (`account_uid`),
  ADD KEY `territory_id` (`territory_id`);

ALTER TABLE `container`
  ADD PRIMARY KEY (`id`),
  ADD KEY `account_uid` (`account_uid`),
  ADD KEY `territory_id` (`territory_id`);

ALTER TABLE `player`
  ADD PRIMARY KEY (`id`),
  ADD KEY `player_uid` (`account_uid`);

ALTER TABLE `player_history`
  ADD PRIMARY KEY (`id`);

ALTER TABLE `territory`
  ADD PRIMARY KEY (`id`),
  ADD KEY `owner_uid` (`owner_uid`),
  ADD KEY `flag_stolen_by_uid` (`flag_stolen_by_uid`);

ALTER TABLE `vehicle`
  ADD PRIMARY KEY (`id`),
  ADD KEY `account_uid` (`account_uid`);


ALTER TABLE `clan`
  MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `construction`
  MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `container`
  MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `player`
  MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;
ALTER TABLE `player_history`
  MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
ALTER TABLE `territory`
  MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `vehicle`
  MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;

ALTER TABLE `account`
  ADD CONSTRAINT `account_ibfk_1` FOREIGN KEY (`clan_id`) REFERENCES `clan` (`id`) ON DELETE SET NULL;

ALTER TABLE `clan`
  ADD CONSTRAINT `clan_ibfk_1` FOREIGN KEY (`leader_uid`) REFERENCES `account` (`uid`) ON DELETE CASCADE;

ALTER TABLE `construction`
  ADD CONSTRAINT `construction_ibfk_1` FOREIGN KEY (`account_uid`) REFERENCES `account` (`uid`) ON DELETE CASCADE,
  ADD CONSTRAINT `construction_ibfk_2` FOREIGN KEY (`territory_id`) REFERENCES `territory` (`id`) ON DELETE CASCADE;

ALTER TABLE `container`
  ADD CONSTRAINT `container_ibfk_1` FOREIGN KEY (`account_uid`) REFERENCES `account` (`uid`) ON DELETE CASCADE,
  ADD CONSTRAINT `container_ibfk_2` FOREIGN KEY (`territory_id`) REFERENCES `territory` (`id`) ON DELETE CASCADE;

ALTER TABLE `player`
  ADD CONSTRAINT `player_ibfk_1` FOREIGN KEY (`account_uid`) REFERENCES `account` (`uid`) ON DELETE CASCADE;

ALTER TABLE `territory`
  ADD CONSTRAINT `territory_ibfk_1` FOREIGN KEY (`owner_uid`) REFERENCES `account` (`uid`) ON DELETE CASCADE,
  ADD CONSTRAINT `territory_ibfk_2` FOREIGN KEY (`flag_stolen_by_uid`) REFERENCES `account` (`uid`) ON DELETE SET NULL;

ALTER TABLE `vehicle`
  ADD CONSTRAINT `vehicle_ibfk_1` FOREIGN KEY (`account_uid`) REFERENCES `account` (`uid`) ON DELETE CASCADE;

 

 

Edited by GR8

Share this post


Link to post
Share on other sites
  • 0
20 minutes ago, BetterDeadThanZed said:

I see no pinned topics in this forum... 

 

dammit, wish i knew that earlier. All the work for nothing. Good job CEN

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.