Emmanuel BENOîT
3a0f5bbb78
Added the necessary database code to convert the contents of event queues into actual event records. The changes include: * a new table, events.pending_events, which is automatically filled by a trigger when events are inserted into queue tables, * the game.events.batchSize constant which defines the maximal amount of events to process in a single transaction, * the events.eq_process() stored procedure, which processes the events. In addition, the "hstore" extension was added as it is the easiest way to convert events from the queues' table model to the store's meta-model.
35 lines
No EOL
967 B
SQL
35 lines
No EOL
967 B
SQL
-- LegacyWorlds Beta 6
|
|
-- PostgreSQL database scripts
|
|
--
|
|
-- Load and configure required PostgreSQL extensions
|
|
--
|
|
-- Copyright(C) 2004-2012, DeepClone Development
|
|
-- --------------------------------------------------------
|
|
|
|
/* Register the dblink extension */
|
|
CREATE EXTENSION dblink;
|
|
|
|
/* Create foreign data wrapper and server used to write logs from within
|
|
* transanctions
|
|
*/
|
|
CREATE FOREIGN DATA WRAPPER pgsql
|
|
VALIDATOR postgresql_fdw_validator;
|
|
|
|
CREATE SERVER srv_logging
|
|
FOREIGN DATA WRAPPER pgsql
|
|
OPTIONS ( hostaddr '127.0.0.1' , dbname :dbname_string );
|
|
|
|
CREATE USER MAPPING FOR :pgadmin
|
|
SERVER srv_logging
|
|
OPTIONS ( user :dbuser_string , password :dbupass );
|
|
|
|
CREATE USER MAPPING FOR :dbuser
|
|
SERVER srv_logging
|
|
OPTIONS ( user :dbuser_string , password :dbupass );
|
|
|
|
GRANT USAGE ON FOREIGN SERVER srv_logging TO :dbuser;
|
|
|
|
/* The events sytem uses the hash store extension to convert events from the
|
|
* queues to main storage.
|
|
*/
|
|
CREATE EXTENSION hstore; |