Specifying 'standard' / 'default' / 'base' data for DB Tables
Jump to navigation
Jump to search
Standard / Base / Default Data: Definition
In this context the meaning of the terms 'standard data', 'default data' and 'base data' are interchangeable. They all mean data that should be available in DB tables of the OpenPetra DB when an OpenPetra DB is 'reset'. That data is currently also taken when a Standalone Release of OpenPetra is done; the result is stored in the file \demodata\databases\empty.yml.
Specifying Standard/ Base / Default Data
- Open the folder \db\basedata
- That folder contains many CSV files - each one is for one specific DB Table in the OpenPetra DB.
- Note: Those files were originally created from Petra 2.x fulldump files.
- If you want to alter, add or delete data in a DB Table for which a CSV file already exists simply open that file in an editor and edit it, looking at other CSV files for the format used to specify columns there.
- If you want to add standard/default data for a DB Table for which no CSV file exists yet, create a new CSV file and fill it, looking at other CSV files for the format used to specify columns there.
- If you have data for that DB Table already available in PostgreSQL you can create a CSV file that comes very close to the needed format with the COPY command: e.g.
COPY p_country to 'C:\temp\p_country_pgadmin.csv' WITH CSV NULL '?'
(run that command and compare with the existing p_country.csv file in the folder to get an idea what the differences are with that method). - Add the new table's CSV file to the file
init.sql
, following the format that is established there for other existing DB Tables' CSV files.
- If you have data for that DB Table already available in PostgreSQL you can create a CSV file that comes very close to the needed format with the COPY command: e.g.
Note: Also in the folder is a file called clean.sql
. Do not alter that file as it is auto-generated by 'nant generateORMTables'