Skip to content

Schema Upgrade Issue (Postgres) #4338

Closed
@montymxb

Description

@montymxb

Issue Description

When upgrading parse-server it's possible to have a situation where, if the default Schemas have been changed in parse-server, and the database is postgres, the underlying database is not updated.

Steps to reproduce

Reproducing with a change in expiration_interval for _PushStatus.

  1. Start parse-server 2.6.4 using a fresh db in postgres 9.5. A garbage push configuration will do just fine for testing.
push: {
    android: {
      senderId: "blank-sender-id",
      apiKey: "not-a-real-api-key"
    }
}
  1. Attempt to send a push using your preferred method. Can use cloud code to do this as well.
Parse.Push.send({
  where: {
    deviceType: 'ios'
  },
  data: {
    badge: 'Increment',
  	alert: 'Hello world!'
  }
});
  1. Push should complete, logs should indicate nothing afoot.
  2. Stop parse-server and upgrade to 2.6.5.
  3. Restart parse-server, connecting to the still running postgres instance.
  4. Attempt to send a push again as stated in step 2.
  5. Observe the following in the log entries (response to push may hang as well)

..."message":"_PushStatus undefined: error while sending push","stack":"error: column "expiration_interval" of relation "_PushStatus" does not exist...

Expected Results

Following observed behavior when using mongodb the underlying schema should be updated when new default fields are available but not present.

Actual Outcome

The underlying schema is not updated when new default fields are available for parse-server's reserved classes.

Environment Setup

  • Server

    • parse-server version: 2.6.4 & 2.6.5
    • Operating System: OSX
    • localhost
  • Database

    • MongoDB version: 3.4.4
    • Postgres version: 9.5
    • localhost

Logs/Trace

Annotated verbose logs entries below. Tests were performed from the php sdk, version 1.3.0.

2.6.4/ initial push request
{"method":"POST","url":"/parse/push","headers":{"host":"localhost:1337","accept":"/","x-parse-application-id":"app-id-here","x-parse-client-version":"php1.3.0","x-parse-master-key":"master-key-here","content-type":"application/json","content-length":"51"},"body":{"channels":[""],"data":{"alert":"sample message"}},"level":"verbose","message":"REQUEST for [POST] /parse/push: {\n "channels": [\n ""\n ],\n "data": {\n "alert": "sample message"\n }\n}","timestamp":"2017-11-11T04:59:08.955Z"}

2.6.4/ response to push request
{"result":{"headers":{"X-Parse-Push-Status-Id":"W7w4WdXQix"},"response":{"result":true}},"level":"verbose","message":"RESPONSE from [POST] /parse/push: {\n "headers": {\n "X-Parse-Push-Status-Id": "W7w4WdXQix"\n },\n "response": {\n "result": true\n }\n}","timestamp":"2017-11-11T04:59:08.973Z"}

upgraded to 2.6.5/ initial push request
{"method":"POST","url":"/parse/push","headers":{"host":"localhost:1337","accept":"/","x-parse-application-id":"app-id-here","x-parse-client-version":"php1.3.0","x-parse-master-key":"master-key-here","content-type":"application/json","content-length":"51"},"body":{"channels":[""],"data":{"alert":"sample message"}},"level":"verbose","message":"REQUEST for [POST] /parse/push: {\n "channels": [\n ""\n ],\n "data": {\n "alert": "sample message"\n }\n}","timestamp":"2017-11-11T05:13:23.205Z"}

upgraded to 2.6.5/ response to push request
{"message":"_PushStatus undefined: error while sending push","stack":"error: column "expiration_interval" of relation "_PushStatus" does not exist\n at Connection.parseE (/Users/Bfriedman/Documents/parse-server-test/node_modules/pg/lib/connection.js:546:11)\n at Connection.parseMessage (/Users/Bfriedman/Documents/parse-server-test/node_modules/pg/lib/connection.js:371:19)\n at Socket. (/Users/Bfriedman/Documents/parse-server-test/node_modules/pg/lib/connection.js:114:22)\n at emitOne (events.js:96:13)\n at Socket.emit (events.js:188:7)\n at readableAddChunk (_stream_readable.js:176:18)\n at Socket.Readable.push (_stream_readable.js:134:10)\n at TCP.onread (net.js:547:20)","name":"error","length":135,"severity":"ERROR","code":"42703","position":"83","file":"parse_target.c","line":"954","routine":"checkInsertTargets","level":"error","timestamp":"2017-11-11T05:13:23.225Z"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugImpaired feature or lacking behavior that is likely assumed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions