As this set of changes modifies the database, this PR serves to document the steps needed to apply this update to any pre-existing instance. The changes are:
Update PostgreSQL from 9.5 to 10.4, which requires a dump/restore of the data
Drop the Damm code check digit from member numbers. In practice this turned out to have no utility, as very few situations make use of the member number anymore, and at each of those additional data was available for confirming the match. (Note: You'll want to decide what to do about your member numbers, either dropping the last digit from past ones or just continuing from where you're currently at. This may require running a few SQL commands.)
Move instance-specific Postgres configuration to a new folder config/database/ and add a README file there. (TODO: Remove magic strings from postgres/init/25-public-data.sql)
A few changes to columns in kansa.people:
Drop can_site_select as unused
Rename can_hugo_nominate as hugo_nominator
Rename can_hugo_vote as hugo_voter
Move all of the payment data from JSON files under kansa/static/ to the database and drop the GET /api/purchase/prices endpoint
To verify that the changes didn't break things and that updating is not too arduous, here are the steps that were required to port the Worldcon 75 data across this update:
Dump the database to a text format with pg_dump -a api > w75-data.sql
Save a SQL file w75-prepare.sql:
SET ROLE kansa;
ALTER TABLE people RENAME COLUMN hugo_nominator TO can_hugo_nominate;
ALTER TABLE people RENAME COLUMN hugo_voter TO can_hugo_vote;
ALTER TABLE people ADD COLUMN can_site_select bool;
DELETE FROM countries; -- Also filled by postgres/init/25-public-data.sql
DELETE FROM daypass_amounts; -- Also filled by config/database/payments.sql
DELETE FROM stripe_keys; -- Also filled by config/database/payments.sql
Save a SQL file w75-cleanup.sql:
SET ROLE kansa;
ALTER TABLE people RENAME COLUMN can_hugo_nominate TO hugo_nominator;
ALTER TABLE people RENAME COLUMN can_hugo_vote TO hugo_voter;
ALTER TABLE people DROP COLUMN can_site_select;
Add the following to the Docker Compose config, making sure that in the container the file names are prefixed to get the right order. Note that here we're using the "development" version of config/payments.sql which is in fact the Worldcon 75 payments data; you'll need to modify this file to match your own data:
As this set of changes modifies the database, this PR serves to document the steps needed to apply this update to any pre-existing instance. The changes are:
config/database/
and add a README file there. (TODO: Remove magic strings frompostgres/init/25-public-data.sql
)kansa.people
:can_site_select
as unusedcan_hugo_nominate
ashugo_nominator
can_hugo_vote
ashugo_voter
kansa/static/
to the database and drop theGET /api/purchase/prices
endpointTo verify that the changes didn't break things and that updating is not too arduous, here are the steps that were required to port the Worldcon 75 data across this update:
Dump the database to a text format with
pg_dump -a api > w75-data.sql
Save a SQL file
w75-prepare.sql
:Save a SQL file
w75-cleanup.sql
:Add the following to the Docker Compose config, making sure that in the container the file names are prefixed to get the right order. Note that here we're using the "development" version of
config/payments.sql
which is in fact the Worldcon 75 payments data; you'll need to modify this file to match your own data:Run
make prod
.