Created
July 6, 2012 15:50
-
-
Save Abstrct/3061011 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE RULE ship_control_update AS | |
ON UPDATE TO my_ships DO INSTEAD ( UPDATE ship_control SET target_speed = new.target_speed, | |
target_direction = new.target_direction, | |
destination_x = COALESCE(new.destination_x, new.destination[0]), | |
destination_y = coalesce(new.destination_y, new.destination[1]), | |
destination = COALESCE(new.destination,POINT(new.destination_x, new.destination_y)), repair_priority = new.repair_priority, action = new.action, action_target_id = new.action_target_id | |
WHERE ship_control.ship_id = new.id; | |
UPDATE ship SET name = new.name, fleet_id = new.fleet_id | |
WHERE ship.id = new.id; | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment