Tweak Postgres migrations

This commit is contained in:
Neil Alexander 2021-01-12 13:30:56 +00:00
parent 3141eaa7a6
commit 53abc2c0ec
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -28,7 +28,7 @@ func LoadRemoveSendToDeviceSentColumn(m *sqlutil.Migrations) {
func UpRemoveSendToDeviceSentColumn(tx *sql.Tx) error {
_, err := tx.Exec(`
ALTER TABLE syncapi_send_to_device
DROP COLUMN sent_by_token;
DROP COLUMN IF EXISTS sent_by_token;
`)
if err != nil {
return fmt.Errorf("failed to execute upgrade: %w", err)
@ -39,7 +39,7 @@ func UpRemoveSendToDeviceSentColumn(tx *sql.Tx) error {
func DownRemoveSendToDeviceSentColumn(tx *sql.Tx) error {
_, err := tx.Exec(`
ALTER TABLE syncapi_send_to_device
ADD COLUMN sent_by_token TEXT;
ADD COLUMN IF NOT EXISTS sent_by_token TEXT;
`)
if err != nil {
return fmt.Errorf("failed to execute downgrade: %w", err)