Browse Source

Feature version bump should use UPDATE instead of INSERT.

Neal Wilson 11 years ago
parent
commit
791a1d99d8
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      config/Windows/navigation.xml

+ 2
- 2
config/Windows/navigation.xml View File

259
 			var query = new QSqlQuery;
259
 			var query = new QSqlQuery;
260
 			query.exec("ALTER TABLE transactions ADD COLUMN person text DEFAULT NULL");
260
 			query.exec("ALTER TABLE transactions ADD COLUMN person text DEFAULT NULL");
261
 			query.exec("ALTER TABLE roasting_log ADD COLUMN person text DEFAULT NULL");
261
 			query.exec("ALTER TABLE roasting_log ADD COLUMN person text DEFAULT NULL");
262
-			query.exec("CREATE FUNCTION log_session_user() RETURNS trigger AS $$ BEGIN NEW.person := session_name; RETURN NEW; END; $$ LANGUAGE plpgsql");
262
+			query.exec("CREATE OR REPLACE FUNCTION log_session_user() RETURNS trigger AS $$ BEGIN NEW.person := session_name; RETURN NEW; END; $$ LANGUAGE plpgsql");
263
 			query.exec("CREATE TRIGGER log_person BEFORE INSERT ON inventory FOR EACH ROW EXECUTE PROCEDURE log_session_user()");
263
 			query.exec("CREATE TRIGGER log_person BEFORE INSERT ON inventory FOR EACH ROW EXECUTE PROCEDURE log_session_user()");
264
 			query.exec("CREATE TRIGGER log_person BEFORE INSERT ON loss FOR EACH ROW EXECUTE PROCEDURE log_session_user()");
264
 			query.exec("CREATE TRIGGER log_person BEFORE INSERT ON loss FOR EACH ROW EXECUTE PROCEDURE log_session_user()");
265
 			query.exec("CREATE TRIGGER log_person BEFORE INSERT ON make FOR EACH ROW EXECUTE PROCEDURE log_session_user()");
265
 			query.exec("CREATE TRIGGER log_person BEFORE INSERT ON make FOR EACH ROW EXECUTE PROCEDURE log_session_user()");
267
 			query.exec("CREATE TRIGGER log_person BEFORE INSERT ON sale FOR EACH ROW EXECUTE PROCEDURE log_session_user()");
267
 			query.exec("CREATE TRIGGER log_person BEFORE INSERT ON sale FOR EACH ROW EXECUTE PROCEDURE log_session_user()");
268
 			query.exec("CREATE TRIGGER log_person BEFORE INSERT ON use FOR EACH ROW EXECUTE PROCEDURE log_session_user()");
268
 			query.exec("CREATE TRIGGER log_person BEFORE INSERT ON use FOR EACH ROW EXECUTE PROCEDURE log_session_user()");
269
 			query.exec("CREATE TRIGGER log_person BEFORE INSERT ON roasting_log FOR EACH ROW EXECUTE PROCEDURE log_session_user()");
269
 			query.exec("CREATE TRIGGER log_person BEFORE INSERT ON roasting_log FOR EACH ROW EXECUTE PROCEDURE log_session_user()");
270
-			query.exec("INSERT INTO TypicaFeatures VALUES('base-features', TRUE, 2)");
270
+			query.exec("UPDATE TypicaFeatures SET version = 2 WHERE feature = 'base-features'");
271
 			query = query.invalidate();
271
 			query = query.invalidate();
272
 		};
272
 		};
273
 		
273
 		

Loading…
Cancel
Save