From 071257786cbf9aad7572625eb949e89b83d9cd8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Mon, 9 Apr 2012 15:01:04 +0200 Subject: [PATCH] Renamed technology tables and views * Removed the _v2 suffix from some tables and views. --- .../PlayerTechnologiesDAOBean.java | 2 +- .../parts/030-data/110-empires.sql | 8 +++--- .../parts/040-functions/030-tech.sql | 4 +-- .../parts/040-functions/040-empire.sql | 2 +- .../040-functions/045-empire-research.sql | 26 +++++++++---------- .../parts/040-functions/140-planets.sql | 8 +++--- .../parts/040-functions/200-bugs.sql | 4 +-- .../parts/050-updates/020-empire-research.sql | 10 +++---- .../030-tech/030-uoc-technology-scale.sql | 8 +++--- .../040-empire/010-create-empire.sql | 4 +-- .../010-technology-implement.sql | 14 +++++----- .../030-resprio-update-start.sql | 4 +-- .../050-resprio-update-apply.sql | 10 +++---- .../060-technology-visibility-view.sql | 4 +-- .../070-research-weights-view.sql | 8 +++--- .../090-technologies-view.sql | 18 ++++++------- .../020-technology-make-identifier.sql | 8 +++--- .../090-technologies-view.sql | 8 +++--- .../setup-gu-research-get-empires-test.sql | 14 +++++----- 19 files changed, 82 insertions(+), 82 deletions(-) diff --git a/legacyworlds-server-beans-technologies/src/main/java/com/deepclone/lw/beans/game/technologies/PlayerTechnologiesDAOBean.java b/legacyworlds-server-beans-technologies/src/main/java/com/deepclone/lw/beans/game/technologies/PlayerTechnologiesDAOBean.java index dc4e437..ba2bf6e 100644 --- a/legacyworlds-server-beans-technologies/src/main/java/com/deepclone/lw/beans/game/technologies/PlayerTechnologiesDAOBean.java +++ b/legacyworlds-server-beans-technologies/src/main/java/com/deepclone/lw/beans/game/technologies/PlayerTechnologiesDAOBean.java @@ -29,7 +29,7 @@ class PlayerTechnologiesDAOBean { /** SQL query that fetches an empire's research state */ - private static final String Q_EMPIRE_RESEARCH = "SELECT * FROM emp.technologies_v2_view WHERE empire_id = ?"; + private static final String Q_EMPIRE_RESEARCH = "SELECT * FROM emp.technologies_view WHERE empire_id = ?"; /** Row mapper for research state entries */ private final ResearchRowMapper mResearch; diff --git a/legacyworlds-server-data/db-structure/parts/030-data/110-empires.sql b/legacyworlds-server-data/db-structure/parts/030-data/110-empires.sql index 91a7c22..54bb9b5 100644 --- a/legacyworlds-server-data/db-structure/parts/030-data/110-empires.sql +++ b/legacyworlds-server-data/db-structure/parts/030-data/110-empires.sql @@ -101,7 +101,7 @@ CREATE TYPE emp.technology_state * research system has been removed */ -CREATE TABLE emp.technologies_v2( +CREATE TABLE emp.technologies( /* Identifier of the empire */ empire_id INT NOT NULL , @@ -136,9 +136,9 @@ CREATE TABLE emp.technologies_v2( ); CREATE INDEX idx_emptech_technology - ON emp.technologies_v2 ( technology_name_id ); + ON emp.technologies ( technology_name_id ); -ALTER TABLE emp.technologies_v2 +ALTER TABLE emp.technologies ADD CONSTRAINT fk_emptech_empire FOREIGN KEY ( empire_id ) REFERENCES emp.empires ( name_id ) ON DELETE CASCADE , @@ -358,4 +358,4 @@ ALTER TABLE emp.enemy_empires ON DELETE CASCADE , ADD CONSTRAINT fk_enemyempires_enemy FOREIGN KEY (enemy_id) REFERENCES emp.empires - ON DELETE CASCADE; \ No newline at end of file + ON DELETE CASCADE; diff --git a/legacyworlds-server-data/db-structure/parts/040-functions/030-tech.sql b/legacyworlds-server-data/db-structure/parts/040-functions/030-tech.sql index 212bce0..d5779bb 100644 --- a/legacyworlds-server-data/db-structure/parts/040-functions/030-tech.sql +++ b/legacyworlds-server-data/db-structure/parts/040-functions/030-tech.sql @@ -140,7 +140,7 @@ BEGIN FROM defs.technologies _def LEFT OUTER JOIN ( SELECT technology_name_id - FROM emp.technologies_v2 _tech + FROM emp.technologies _tech WHERE technology_name_id = _name_id AND emptech_state = 'RESEARCH' FOR UPDATE OF _tech @@ -173,7 +173,7 @@ BEGIN -- Update empire research if necessary IF _old_points <> _points THEN _multi := _points::DOUBLE PRECISION / _old_points::DOUBLE PRECISION; - UPDATE emp.technologies_v2 + UPDATE emp.technologies SET emptech_points = emptech_points * _multi WHERE technology_name_id = _name_id AND emptech_points IS NOT NULL; diff --git a/legacyworlds-server-data/db-structure/parts/040-functions/040-empire.sql b/legacyworlds-server-data/db-structure/parts/040-functions/040-empire.sql index 7b1e6ad..28f3377 100644 --- a/legacyworlds-server-data/db-structure/parts/040-functions/040-empire.sql +++ b/legacyworlds-server-data/db-structure/parts/040-functions/040-empire.sql @@ -46,7 +46,7 @@ BEGIN SELECT _name_id , resource_name_id FROM defs.resources; -- Insert technologies that have no dependencies as research in progress - INSERT INTO emp.technologies_v2 ( empire_id , technology_name_id ) + INSERT INTO emp.technologies ( empire_id , technology_name_id ) SELECT _name_id , technology_name_id FROM defs.technologies LEFT OUTER JOIN defs.technology_dependencies diff --git a/legacyworlds-server-data/db-structure/parts/040-functions/045-empire-research.sql b/legacyworlds-server-data/db-structure/parts/040-functions/045-empire-research.sql index 4b1e967..42f3eaf 100644 --- a/legacyworlds-server-data/db-structure/parts/040-functions/045-empire-research.sql +++ b/legacyworlds-server-data/db-structure/parts/040-functions/045-empire-research.sql @@ -38,7 +38,7 @@ BEGIN SELECT INTO _impl_data technology_name_id , technology_price FROM emp.empires _emp - INNER JOIN emp.technologies_v2 _tech + INNER JOIN emp.technologies _tech ON _tech.empire_id = _emp.name_id INNER JOIN defs.technologies _def USING ( technology_name_id ) @@ -58,25 +58,25 @@ BEGIN UPDATE emp.empires SET cash = cash - _impl_data.technology_price WHERE name_id = _empire; - UPDATE emp.technologies_v2 + UPDATE emp.technologies SET emptech_state = 'KNOWN' WHERE empire_id = _empire AND technology_name_id = _impl_data.technology_name_id; -- Insert new research - INSERT INTO emp.technologies_v2 ( empire_id , technology_name_id ) + INSERT INTO emp.technologies ( empire_id , technology_name_id ) SELECT _empire , _valid.technology_name_id FROM ( SELECT _tech.technology_name_id , ( COUNT(*) = COUNT(_emptech.emptech_state) ) AS emptech_has_dependencies FROM defs.technologies _tech INNER JOIN defs.technology_dependencies _deps USING ( technology_name_id ) - LEFT OUTER JOIN emp.technologies_v2 _emptech + LEFT OUTER JOIN emp.technologies _emptech ON _emptech.technology_name_id = _deps.technology_name_id_depends AND _emptech.emptech_state = 'KNOWN' AND _emptech.empire_id = _empire GROUP BY _tech.technology_name_id ) _valid - LEFT OUTER JOIN emp.technologies_v2 _emptech + LEFT OUTER JOIN emp.technologies _emptech ON _emptech.empire_id = _empire AND _emptech.technology_name_id = _valid.technology_name_id WHERE _emptech.empire_id IS NULL AND _valid.emptech_has_dependencies; @@ -177,7 +177,7 @@ BEGIN emp.technology_make_identifier( empire_id , _str.name , emptech_visible ) , _etech.emptech_priority FROM emp.empires _emp - INNER JOIN emp.technologies_v2 _etech + INNER JOIN emp.technologies _etech ON _etech.empire_id = _emp.name_id AND _etech.emptech_state = 'RESEARCH' INNER JOIN defs.technologies _tech @@ -270,7 +270,7 @@ CREATE FUNCTION emp.resprio_update_apply( ) AS $resprio_update_apply$ BEGIN - UPDATE emp.technologies_v2 + UPDATE emp.technologies SET emptech_priority = _emptech_priority FROM rprio_update WHERE _empire_id = empire_id @@ -367,7 +367,7 @@ CREATE VIEW emp.technology_visibility_view OR emptech_points >= sys.get_constant( 'game.research.visibility.points' ) OR emptech_points / technology_points::DOUBLE PRECISION >= sys.get_constant( 'game.research.visibility.ratio' ) ) AS emptech_visible - FROM emp.technologies_v2 + FROM emp.technologies INNER JOIN defs.technologies USING ( technology_name_id ); @@ -390,7 +390,7 @@ CREATE VIEW emp.research_weights_view AS SELECT empire_id , technology_name_id , POW( sys.get_constant( 'game.research.weightBase' ) , emptech_priority ) AS emptech_weight - FROM emp.technologies_v2 + FROM emp.technologies WHERE emptech_state = 'RESEARCH'; /* @@ -450,8 +450,8 @@ CREATE VIEW emp.research_total_weights_view * technology_buildings The buildings which are unlocked when the * technology is implemented */ -DROP VIEW IF EXISTS emp.technologies_v2_view CASCADE; -CREATE VIEW emp.technologies_v2_view +DROP VIEW IF EXISTS emp.technologies_view CASCADE; +CREATE VIEW emp.technologies_view AS SELECT empire_id , emp.technology_make_identifier( empire_id , _name_str.name , emptech_visible ) AS emptech_id , emptech_state , @@ -497,7 +497,7 @@ CREATE VIEW emp.technologies_v2_view ELSE '' END ) AS technology_buildings - FROM emp.technologies_v2 + FROM emp.technologies INNER JOIN emp.technology_visibility_view USING ( technology_name_id , empire_id ) INNER JOIN defs.technologies _tech @@ -514,5 +514,5 @@ CREATE VIEW emp.technologies_v2_view ON _descr_str.id = _tech.technology_description_id; GRANT SELECT - ON emp.technologies_v2_view + ON emp.technologies_view TO :dbuser; diff --git a/legacyworlds-server-data/db-structure/parts/040-functions/140-planets.sql b/legacyworlds-server-data/db-structure/parts/040-functions/140-planets.sql index 2f7d5d9..8c4955a 100644 --- a/legacyworlds-server-data/db-structure/parts/040-functions/140-planets.sql +++ b/legacyworlds-server-data/db-structure/parts/040-functions/140-planets.sql @@ -479,7 +479,7 @@ AS $$ UNION SELECT bv.* FROM tech.buildings_view bv INNER JOIN emp.planets ep ON ep.planet_id = $1 - INNER JOIN emp.technologies_v2 _emptech + INNER JOIN emp.technologies _emptech USING ( technology_name_id , empire_id ) WHERE emptech_state = 'KNOWN' ) AS bv , ( @@ -530,7 +530,7 @@ AS $$ UNION SELECT bv.* FROM tech.ships_view bv INNER JOIN emp.planets ep ON ep.planet_id = $1 - INNER JOIN emp.technologies_v2 t + INNER JOIN emp.technologies t USING ( empire_id , technology_name_id ) WHERE emptech_state = 'KNOWN' ) AS bv , ( @@ -712,7 +712,7 @@ BEGIN FROM tech.ships s INNER JOIN tech.buildables b ON b.name_id = s.buildable_id - LEFT OUTER JOIN emp.technologies_v2 t + LEFT OUTER JOIN emp.technologies t ON t.empire_id = e_id AND t.technology_name_id = b.technology_name_id AND t.emptech_state = 'KNOWN' WHERE s.buildable_id = s_id; @@ -778,7 +778,7 @@ BEGIN FROM tech.buildings s INNER JOIN tech.buildables b ON b.name_id = s.buildable_id - LEFT OUTER JOIN emp.technologies_v2 t + LEFT OUTER JOIN emp.technologies t ON t.empire_id = e_id AND t.technology_name_id = b.technology_name_id AND t.emptech_state = 'KNOWN' WHERE s.buildable_id = b_id; diff --git a/legacyworlds-server-data/db-structure/parts/040-functions/200-bugs.sql b/legacyworlds-server-data/db-structure/parts/040-functions/200-bugs.sql index c339285..dedf305 100644 --- a/legacyworlds-server-data/db-structure/parts/040-functions/200-bugs.sql +++ b/legacyworlds-server-data/db-structure/parts/040-functions/200-bugs.sql @@ -1198,7 +1198,7 @@ GRANT SELECT ON bugs.dump_main_view TO :dbuser; CREATE VIEW bugs.dump_research_view AS SELECT et.empire_id , tst.name AS name , et.emptech_state AS state , et.emptech_points AS points , et.emptech_priority AS priority - FROM emp.technologies_v2 et + FROM emp.technologies et INNER JOIN defs.strings tst ON tst.id = et.technology_name_id; GRANT SELECT ON bugs.dump_research_view TO :dbuser; @@ -1360,4 +1360,4 @@ CREATE VIEW bugs.dump_ships_view INNER JOIN defs.strings sn ON sn.id = s.ship_id ORDER BY s.ship_id; -GRANT SELECT ON bugs.dump_ships_view TO :dbuser; \ No newline at end of file +GRANT SELECT ON bugs.dump_ships_view TO :dbuser; diff --git a/legacyworlds-server-data/db-structure/parts/050-updates/020-empire-research.sql b/legacyworlds-server-data/db-structure/parts/050-updates/020-empire-research.sql index fa73323..6500839 100644 --- a/legacyworlds-server-data/db-structure/parts/050-updates/020-empire-research.sql +++ b/legacyworlds-server-data/db-structure/parts/050-updates/020-empire-research.sql @@ -60,7 +60,7 @@ AS $gu_research_get_empires$ USING ( updtgt_id , updtype_id , update_id ) INNER JOIN emp.empires _empire USING ( name_id ) - INNER JOIN emp.technologies_v2 _emp_tech + INNER JOIN emp.technologies _emp_tech ON _emp_tech.empire_id = _empire.name_id INNER JOIN defs.technologies _tech USING ( technology_name_id ) @@ -121,7 +121,7 @@ BEGIN SELECT _emp_tech.technology_name_id , _emp_tech.emptech_points , _emp_tech.emptech_priority , _points * _weights.emptech_weight / ( _totals.emptech_total_weight * 1440 ) AS emptech_new_points , _def.technology_points::DOUBLE PRECISION AS technology_points - FROM emp.technologies_v2 _emp_tech + FROM emp.technologies _emp_tech INNER JOIN emp.research_weights_view _weights USING ( empire_id , technology_name_id ) INNER JOIN emp.research_total_weights_view _totals @@ -133,7 +133,7 @@ BEGIN LOOP IF _record.emptech_points + _record.emptech_new_points >= _record.technology_points THEN - UPDATE emp.technologies_v2 + UPDATE emp.technologies SET emptech_state = 'PENDING' , emptech_points = NULL , emptech_priority = NULL @@ -141,7 +141,7 @@ BEGIN AND empire_id = _empire; ELSE - UPDATE emp.technologies_v2 + UPDATE emp.technologies SET emptech_points = emptech_points + _record.emptech_new_points WHERE technology_name_id = _record.technology_name_id AND empire_id = _empire; @@ -189,4 +189,4 @@ REVOKE EXECUTE SELECT sys.register_update_type( 'Empires' , 'EmpireResearch' , 'Empire research points are being attributed to technologies.' , 'process_empire_research_updates' - ); \ No newline at end of file + ); diff --git a/legacyworlds-server-data/db-structure/tests/admin/040-functions/030-tech/030-uoc-technology-scale.sql b/legacyworlds-server-data/db-structure/tests/admin/040-functions/030-tech/030-uoc-technology-scale.sql index 595bb7f..79722fa 100644 --- a/legacyworlds-server-data/db-structure/tests/admin/040-functions/030-tech/030-uoc-technology-scale.sql +++ b/legacyworlds-server-data/db-structure/tests/admin/040-functions/030-tech/030-uoc-technology-scale.sql @@ -24,11 +24,11 @@ BEGIN; ); /* Remove foreign key to empires on empire technologies */ - ALTER TABLE emp.technologies_v2 + ALTER TABLE emp.technologies DROP CONSTRAINT fk_emptech_empire; /* Insert records for the new technology, with different states */ - INSERT INTO emp.technologies_v2 ( + INSERT INTO emp.technologies ( empire_id , technology_name_id , emptech_state , emptech_points , emptech_priority ) VALUES ( @@ -46,7 +46,7 @@ BEGIN; SELECT diag_test_name( 'defs.uoc_technology() - Update - Scaling of in-progress research' ); SELECT set_eq( $$ SELECT empire_id , ROUND( emptech_points )::INT - FROM emp.technologies_v2 + FROM emp.technologies WHERE emptech_state = 'RESEARCH' $$ , $$ VALUES( 1 , 500 @@ -55,4 +55,4 @@ BEGIN; ) $$ ); SELECT * FROM finish( ); -ROLLBACK; \ No newline at end of file +ROLLBACK; diff --git a/legacyworlds-server-data/db-structure/tests/admin/040-functions/040-empire/010-create-empire.sql b/legacyworlds-server-data/db-structure/tests/admin/040-functions/040-empire/010-create-empire.sql index c079d75..9f7ba70 100644 --- a/legacyworlds-server-data/db-structure/tests/admin/040-functions/040-empire/010-create-empire.sql +++ b/legacyworlds-server-data/db-structure/tests/admin/040-functions/040-empire/010-create-empire.sql @@ -117,7 +117,7 @@ BEGIN; SELECT diag_test_name( 'emp.create_empire() - Empire technologies have been initialised' ); SELECT set_eq( $$ SELECT technology_name_id , emptech_state::TEXT , emptech_points , emptech_priority - FROM emp.technologies_v2 + FROM emp.technologies WHERE empire_id = _get_emp_name( 'testEmp1' ); $$ , $$ VALUES( _get_string( 'tech1' ) , 'RESEARCH' , 0.0 , 2 @@ -130,4 +130,4 @@ BEGIN; AND resource_name_id = _get_string( 'natRes1' ); SELECT * FROM finish( ); -ROLLBACK; \ No newline at end of file +ROLLBACK; diff --git a/legacyworlds-server-data/db-structure/tests/admin/040-functions/045-empire-research/010-technology-implement.sql b/legacyworlds-server-data/db-structure/tests/admin/040-functions/045-empire-research/010-technology-implement.sql index 8479524..5ec2087 100644 --- a/legacyworlds-server-data/db-structure/tests/admin/040-functions/045-empire-research/010-technology-implement.sql +++ b/legacyworlds-server-data/db-structure/tests/admin/040-functions/045-empire-research/010-technology-implement.sql @@ -36,20 +36,20 @@ BEGIN; ( _get_string( 'tech3' ) , _get_string( 'tech2' ) ); /* Empire "emp1" has only in-progress research. */ - INSERT INTO emp.technologies_v2 ( empire_id , technology_name_id ) + INSERT INTO emp.technologies ( empire_id , technology_name_id ) VALUES( _get_emp_name( 'emp1' ) , _get_string( 'tech1' ) ); /* Empire "emp2" has a pending technology. */ - INSERT INTO emp.technologies_v2 ( empire_id , technology_name_id , emptech_state , emptech_points , emptech_priority ) + INSERT INTO emp.technologies ( empire_id , technology_name_id , emptech_state , emptech_points , emptech_priority ) VALUES( _get_emp_name( 'emp2' ) , _get_string( 'tech1' ) , 'PENDING' , NULL , NULL ); /* Empire "emp3" has implemented 'tech1' and has 'tech2' as pending. */ - INSERT INTO emp.technologies_v2 ( empire_id , technology_name_id , emptech_state , emptech_points , emptech_priority ) + INSERT INTO emp.technologies ( empire_id , technology_name_id , emptech_state , emptech_points , emptech_priority ) VALUES( _get_emp_name( 'emp3' ) , _get_string( 'tech1' ) , 'KNOWN' , NULL , NULL ) , ( _get_emp_name( 'emp3' ) , _get_string( 'tech2' ) , 'PENDING' , NULL , NULL ); /* Empire "emp4" has implemented 'tech1' and 'tech2' and has 'tech3' as pending. */ - INSERT INTO emp.technologies_v2 ( empire_id , technology_name_id , emptech_state , emptech_points , emptech_priority ) + INSERT INTO emp.technologies ( empire_id , technology_name_id , emptech_state , emptech_points , emptech_priority ) VALUES( _get_emp_name( 'emp4' ) , _get_string( 'tech1' ) , 'KNOWN' , NULL , NULL ) , ( _get_emp_name( 'emp4' ) , _get_string( 'tech2' ) , 'KNOWN' , NULL , NULL ) , ( _get_emp_name( 'emp4' ) , _get_string( 'tech3' ) , 'PENDING' , NULL , NULL ); @@ -72,7 +72,7 @@ BEGIN; SELECT diag_test_name( 'emp.technology_implement() - Call on pending technology - No new research - Table contents' ); SELECT set_eq( $$ SELECT technology_name_id , emptech_state::TEXT - FROM emp.technologies_v2 + FROM emp.technologies WHERE empire_id = _get_emp_name( 'emp2' ) $$ , $$ VALUES( _get_string( 'tech1' ) , 'KNOWN' @@ -88,7 +88,7 @@ BEGIN; SELECT diag_test_name( 'emp.technology_implement() - Call on pending technology - New research - Table contents' ); SELECT set_eq( $$ SELECT technology_name_id , emptech_state::TEXT - FROM emp.technologies_v2 + FROM emp.technologies WHERE empire_id = _get_emp_name( 'emp3' ) $$ , $$ VALUES( _get_string( 'tech1' ) , 'KNOWN' @@ -107,4 +107,4 @@ BEGIN; SELECT ok( NOT emp.technology_implement( _get_emp_name( 'emp4' ) , 'tech3' ) ); SELECT * FROM finish( ); -ROLLBACK; \ No newline at end of file +ROLLBACK; diff --git a/legacyworlds-server-data/db-structure/tests/admin/040-functions/045-empire-research/030-resprio-update-start.sql b/legacyworlds-server-data/db-structure/tests/admin/040-functions/045-empire-research/030-resprio-update-start.sql index 5355333..ea0cf98 100644 --- a/legacyworlds-server-data/db-structure/tests/admin/040-functions/045-empire-research/030-resprio-update-start.sql +++ b/legacyworlds-server-data/db-structure/tests/admin/040-functions/045-empire-research/030-resprio-update-start.sql @@ -46,7 +46,7 @@ BEGIN; AS SELECT * FROM _fake_visibility; /* Insert empire state and data for fake views */ - INSERT INTO emp.technologies_v2 ( + INSERT INTO emp.technologies ( empire_id , technology_name_id , emptech_state , emptech_points , emptech_priority ) VALUES ( @@ -102,4 +102,4 @@ BEGIN; DROP TABLE IF EXISTS rprio_update; SELECT * FROM finish( ); -ROLLBACK; \ No newline at end of file +ROLLBACK; diff --git a/legacyworlds-server-data/db-structure/tests/admin/040-functions/045-empire-research/050-resprio-update-apply.sql b/legacyworlds-server-data/db-structure/tests/admin/040-functions/045-empire-research/050-resprio-update-apply.sql index d7ca259..11ec682 100644 --- a/legacyworlds-server-data/db-structure/tests/admin/040-functions/045-empire-research/050-resprio-update-apply.sql +++ b/legacyworlds-server-data/db-structure/tests/admin/040-functions/045-empire-research/050-resprio-update-apply.sql @@ -23,7 +23,7 @@ BEGIN; INSERT INTO defs.technologies ( technology_name_id ) VALUES ( _get_string( 'tech1' ) ); - INSERT INTO emp.technologies_v2( + INSERT INTO emp.technologies( empire_id , technology_name_id , emptech_state , emptech_points , emptech_priority ) VALUES ( @@ -52,7 +52,7 @@ BEGIN; SELECT diag_test_name( 'emp.resprio_update_apply() - Applying a valid update - Table contents' ); SELECT set_eq( $$ SELECT empire_id , emptech_priority - FROM emp.technologies_v2 + FROM emp.technologies WHERE technology_name_id = _get_string( 'tech1' ); $$ , $$ VALUES( _get_emp_name( 'emp1' ) , 1 @@ -60,7 +60,7 @@ BEGIN; _get_emp_name( 'emp2' ) , 2 ) $$ ); DELETE FROM rprio_update; - UPDATE emp.technologies_v2 + UPDATE emp.technologies SET emptech_priority = 2 WHERE technology_name_id = _get_string( 'tech1' ); @@ -71,7 +71,7 @@ BEGIN; SELECT diag_test_name( 'emp.resprio_update_apply() - Applying an invalid update - Table contents' ); SELECT set_eq( $$ SELECT empire_id , emptech_priority - FROM emp.technologies_v2 + FROM emp.technologies $$ , $$ VALUES( _get_emp_name( 'emp1' ) , 2 ) , ( @@ -79,4 +79,4 @@ BEGIN; ) $$ ); SELECT * FROM finish( ); -ROLLBACK; \ No newline at end of file +ROLLBACK; diff --git a/legacyworlds-server-data/db-structure/tests/admin/040-functions/045-empire-research/060-technology-visibility-view.sql b/legacyworlds-server-data/db-structure/tests/admin/040-functions/045-empire-research/060-technology-visibility-view.sql index d5b22ac..1f0ab1a 100644 --- a/legacyworlds-server-data/db-structure/tests/admin/040-functions/045-empire-research/060-technology-visibility-view.sql +++ b/legacyworlds-server-data/db-structure/tests/admin/040-functions/045-empire-research/060-technology-visibility-view.sql @@ -39,7 +39,7 @@ BEGIN; ( _get_string( 'tech6' ) , 1000 ); /* Insert empire state */ - INSERT INTO emp.technologies_v2 ( + INSERT INTO emp.technologies ( empire_id , technology_name_id , emptech_state , emptech_points , emptech_priority ) VALUES ( @@ -108,4 +108,4 @@ BEGIN; SELECT * FROM finish( ); -ROLLBACK; \ No newline at end of file +ROLLBACK; diff --git a/legacyworlds-server-data/db-structure/tests/admin/040-functions/045-empire-research/070-research-weights-view.sql b/legacyworlds-server-data/db-structure/tests/admin/040-functions/045-empire-research/070-research-weights-view.sql index 37f9dac..442c361 100644 --- a/legacyworlds-server-data/db-structure/tests/admin/040-functions/045-empire-research/070-research-weights-view.sql +++ b/legacyworlds-server-data/db-structure/tests/admin/040-functions/045-empire-research/070-research-weights-view.sql @@ -3,13 +3,13 @@ */ BEGIN; /* Remove foreign keys from the empire research table */ - ALTER TABLE emp.technologies_v2 + ALTER TABLE emp.technologies DROP CONSTRAINT fk_emptech_empire , DROP CONSTRAINT fk_emptech_technology; /* Insert a few records */ - DELETE FROM emp.technologies_v2; - INSERT INTO emp.technologies_v2 ( + DELETE FROM emp.technologies; + INSERT INTO emp.technologies ( empire_id , technology_name_id , emptech_state , emptech_points , emptech_priority ) VALUES @@ -39,4 +39,4 @@ BEGIN; $$ ); SELECT * FROM finish( ); -ROLLBACK; \ No newline at end of file +ROLLBACK; diff --git a/legacyworlds-server-data/db-structure/tests/admin/040-functions/045-empire-research/090-technologies-view.sql b/legacyworlds-server-data/db-structure/tests/admin/040-functions/045-empire-research/090-technologies-view.sql index f2dd122..109f0be 100644 --- a/legacyworlds-server-data/db-structure/tests/admin/040-functions/045-empire-research/090-technologies-view.sql +++ b/legacyworlds-server-data/db-structure/tests/admin/040-functions/045-empire-research/090-technologies-view.sql @@ -1,5 +1,5 @@ /* - * Unit tests for emp.technologies_v2_view + * Unit tests for emp.technologies_view */ BEGIN; \i utils/strings.sql @@ -54,7 +54,7 @@ BEGIN; AS SELECT * FROM _fake_deps; /* Insert empire states and data for fake views */ - INSERT INTO emp.technologies_v2 ( + INSERT INTO emp.technologies ( empire_id , technology_name_id , emptech_state , emptech_points , emptech_priority ) VALUES ( @@ -79,14 +79,14 @@ BEGIN; -- ***** TESTS BEGIN HERE ***** SELECT plan( 3 ); - SELECT diag_test_name( 'emp.technologies_v2_view - Known technology' ); + SELECT diag_test_name( 'emp.technologies_view - Known technology' ); SELECT set_eq( $$ SELECT emptech_id , emptech_state::TEXT , emptech_visible , technology_category , technology_name , technology_description , emptech_points , emptech_priority IS NULL AS ep_null , emptech_ratio IS NULL AS er_null , technology_price , technology_dependencies - FROM emp.technologies_v2_view + FROM emp.technologies_view WHERE empire_id = _get_emp_name( 'emp1' ) $$ , $$ VALUES( _get_emp_name( 'emp1' ) || ',tech1,true' , 'KNOWN' , TRUE , @@ -94,13 +94,13 @@ BEGIN; 456 , TRUE , TRUE , 123 , 'deps are here' ) $$ ); - SELECT diag_test_name( 'emp.technologies_v2_view - In-progress, visible technology' ); + SELECT diag_test_name( 'emp.technologies_view - In-progress, visible technology' ); SELECT set_eq( $$ SELECT emptech_id , emptech_state::TEXT , emptech_visible , technology_category , technology_name , technology_description , emptech_points , emptech_priority , emptech_ratio , technology_price , technology_dependencies - FROM emp.technologies_v2_view + FROM emp.technologies_view WHERE empire_id = _get_emp_name( 'emp2' ) $$ , $$ VALUES( _get_emp_name( 'emp2' ) || ',tech1,true' , 'RESEARCH' , TRUE , @@ -108,13 +108,13 @@ BEGIN; 228 , 0 , 50 , 123 , 'deps are here' ) $$ ); - SELECT diag_test_name( 'emp.technologies_v2_view - In-progress, unknown technology' ); + SELECT diag_test_name( 'emp.technologies_view - In-progress, unknown technology' ); SELECT set_eq( $$ SELECT emptech_id , emptech_state::TEXT , emptech_visible , technology_category , technology_name IS NULL AS n1 , technology_description IS NULL AS n2 , emptech_points IS NULL AS n3 , emptech_priority , emptech_ratio , technology_price IS NULL AS n4, technology_dependencies - FROM emp.technologies_v2_view + FROM emp.technologies_view WHERE empire_id = _get_emp_name( 'emp3' ) $$ , $$ VALUES( _get_emp_name( 'emp3' ) || ',tech1,false' , 'RESEARCH' , FALSE , @@ -122,4 +122,4 @@ BEGIN; TRUE , 1 , 25 , TRUE , 'deps are here' ) $$ ); SELECT * FROM finish( ); -ROLLBACK; \ No newline at end of file +ROLLBACK; diff --git a/legacyworlds-server-data/db-structure/tests/user/040-functions/045-empire-research/020-technology-make-identifier.sql b/legacyworlds-server-data/db-structure/tests/user/040-functions/045-empire-research/020-technology-make-identifier.sql index 4f33b2e..92cd282 100644 --- a/legacyworlds-server-data/db-structure/tests/user/040-functions/045-empire-research/020-technology-make-identifier.sql +++ b/legacyworlds-server-data/db-structure/tests/user/040-functions/045-empire-research/020-technology-make-identifier.sql @@ -5,10 +5,10 @@ BEGIN; SELECT plan( 1 ); - SELECT diag_test_name( 'emp.technology_make_identifier() - No EXECUTE privilege' ); - SELECT throws_ok( $$ + SELECT diag_test_name( 'emp.technology_make_identifier() - EXECUTE privilege' ); + SELECT lives_ok( $$ SELECT emp.technology_make_identifier( 1 , '' , FALSE ); - $$ , 42501 ); + $$ ); SELECT * FROM finish( ); -ROLLBACK; \ No newline at end of file +ROLLBACK; diff --git a/legacyworlds-server-data/db-structure/tests/user/040-functions/045-empire-research/090-technologies-view.sql b/legacyworlds-server-data/db-structure/tests/user/040-functions/045-empire-research/090-technologies-view.sql index a869fd4..cf52fd8 100644 --- a/legacyworlds-server-data/db-structure/tests/user/040-functions/045-empire-research/090-technologies-view.sql +++ b/legacyworlds-server-data/db-structure/tests/user/040-functions/045-empire-research/090-technologies-view.sql @@ -1,15 +1,15 @@ /* - * Test privileges on emp.technologies_v2_view + * Test privileges on emp.technologies_view */ BEGIN; \i utils/strings.sql SELECT plan( 1 ); - SELECT diag_test_name( 'emp.technologies_v2_view - SELECT privilege' ); + SELECT diag_test_name( 'emp.technologies_view - SELECT privilege' ); SELECT lives_ok( $$ - SELECT * FROM emp.technologies_v2_view; + SELECT * FROM emp.technologies_view; $$ ); SELECT * FROM finish( ); -ROLLBACK; \ No newline at end of file +ROLLBACK; diff --git a/legacyworlds-server-data/db-structure/tests/utils/common-setup/setup-gu-research-get-empires-test.sql b/legacyworlds-server-data/db-structure/tests/utils/common-setup/setup-gu-research-get-empires-test.sql index 104a22e..9c22e59 100644 --- a/legacyworlds-server-data/db-structure/tests/utils/common-setup/setup-gu-research-get-empires-test.sql +++ b/legacyworlds-server-data/db-structure/tests/utils/common-setup/setup-gu-research-get-empires-test.sql @@ -47,7 +47,7 @@ INSERT INTO verse.planet_happiness( planet_id , target , current ) */ INSERT INTO emp.empires( name_id , cash ) VALUES( _get_emp_name( 'emp1' ) , 100.0 ); -INSERT INTO emp.technologies_v2 ( +INSERT INTO emp.technologies ( empire_id , technology_name_id , emptech_state , emptech_points , emptech_priority ) SELECT _get_emp_name( 'emp1' ) , technology_name_id , 'KNOWN' , NULL , NULL @@ -59,7 +59,7 @@ INSERT INTO emp.technologies_v2 ( */ INSERT INTO emp.empires( name_id , cash ) VALUES( _get_emp_name( 'emp2' ) , 100.0 ); -INSERT INTO emp.technologies_v2 ( +INSERT INTO emp.technologies ( empire_id , technology_name_id , emptech_state , emptech_points , emptech_priority ) SELECT _get_emp_name( 'emp2' ) , technology_name_id , 'KNOWN' , NULL , NULL @@ -72,7 +72,7 @@ INSERT INTO emp.planets( empire_id , planet_id ) */ INSERT INTO emp.empires( name_id , cash ) VALUES( _get_emp_name( 'emp3' ) , 100.0 ); -INSERT INTO emp.technologies_v2 ( empire_id , technology_name_id ) +INSERT INTO emp.technologies ( empire_id , technology_name_id ) SELECT _get_emp_name( 'emp3' ) , technology_name_id FROM defs.technologies; @@ -82,7 +82,7 @@ INSERT INTO emp.technologies_v2 ( empire_id , technology_name_id ) */ INSERT INTO emp.empires( name_id , cash ) VALUES( _get_emp_name( 'emp4' ) , 100.0 ); -INSERT INTO emp.technologies_v2 ( empire_id , technology_name_id ) +INSERT INTO emp.technologies ( empire_id , technology_name_id ) SELECT _get_emp_name( 'emp4' ) , technology_name_id FROM defs.technologies; INSERT INTO emp.planets( empire_id , planet_id ) @@ -97,7 +97,7 @@ INSERT INTO emp.planets( empire_id , planet_id ) */ INSERT INTO emp.empires( name_id , cash ) VALUES( _get_emp_name( 'emp5' ) , 100.0 ); -INSERT INTO emp.technologies_v2 ( empire_id , technology_name_id ) +INSERT INTO emp.technologies ( empire_id , technology_name_id ) SELECT _get_emp_name( 'emp5' ) , technology_name_id FROM defs.technologies; INSERT INTO emp.planets( empire_id , planet_id ) @@ -117,7 +117,7 @@ INSERT INTO users.vacations ( account_id , since , status ) */ INSERT INTO emp.empires( name_id , cash ) VALUES( _get_emp_name( 'emp6' ) , 100.0 ); -INSERT INTO emp.technologies_v2 ( empire_id , technology_name_id ) +INSERT INTO emp.technologies ( empire_id , technology_name_id ) SELECT _get_emp_name( 'emp6' ) , technology_name_id FROM defs.technologies; INSERT INTO emp.planets( empire_id , planet_id ) @@ -134,4 +134,4 @@ UPDATE sys.updates su SET update_state = 'PROCESSED' , update_last = 0 FROM emp.empires_updates eu WHERE eu.update_id = su.update_id - AND eu.name_id = _get_emp_name( 'emp6' ); \ No newline at end of file + AND eu.name_id = _get_emp_name( 'emp6' );