How to create the SQL dump for the release

From MapbenderWiki

Jump to: navigation, search

Contents

update the db-schema

add the changes listed in dbchanges to the files

resources/db/postgresql/pgsql_schema.sql
resources/db/mysql/mysql_schema.sql

dump the template database data

  • The template is the database used for the previous release. The character set of the template is UTF-8.
command line
pg_dump -F p -a -D -f "pgsql_data.sql" <template database name>
pgAdmin III

Image:Pgadmin dump.jpg

  • Add the correct header information (version number, date , db type, encoding) in the file, like
--  
-- postgresql data utf8
-- 
-- Mapbender (Version: 2.4.2)
-- 2007-06-01
  • Copy the file pgsql_data.sql to the folder
/resources/db/mysql/utf8/

and correct the header information.

PostgreSQL

insert at the beginning:

UPDATE pg_catalog.pg_class SET reltriggers = 0;

insert at the end:

UPDATE pg_catalog.pg_class SET reltriggers = (SELECT pg_catalog.count(*) FROM pg_catalog.pg_trigger where pg_class.oid = tgrelid) ; 

MySQL

insert at the beginning:

SET FOREIGN_KEY_CHECKS=0;

insert at the end:

SET FOREIGN_KEY_CHECKS=1;
Probleme mit PostgreSQL Backslash Encoding (siehe Trac ticket)

Vorläufige Lösung: suchen nach

, E' 

ersetzen durch

, '

im VI mit

:%s/, E'/, '/g

ISO dump

For the ISO dump, copy the files mysql_data.sql and pgsql_data.sql to the folders

/resources/db/postgresql/iso/
/resources/db/mysql/iso/

and convert the files

via iconv

iconv -c -f UTF-8 -t ISO8859-1  /resources/db/postgresql/iso/pgsql_data.sql
iconv -c -f UTF-8 -t ISO8859-1  /resources/db/mysql/iso/mysql_data.sql

With the option -c iconv doesn't convert UTF8 characters unknown in ISO8859-1 (without -c the conversion will probably fail).

Afterwards correct the header information in the files (see above).

commit to svn

Don't forget to commit the files to the SVN!

Personal tools