Error: unknown migration in database

i configured lora-server-app on ubuntu 18.04 with 2 databases as it said on the list.loraserver is configured with dsn=“postgres://loraserver_ns:dbpassword@localhost/loraserver_ns?sslmode=disable” and lora-server-app is configured with dsn=“postgres://loraserver_as:dbpassword@localhost/loraserver_as?sslmode=disable” just as documentation states. I cant start lora-app-server.I get the following error
Sep 25 14:58:32 ip-172-26-15-28 systemd[1]: Stopped LoRa App Server.
Sep 25 14:58:32 ip-172-26-15-28 systemd[1]: Started LoRa App Server.
Sep 25 14:58:32 ip-172-26-15-28 lora-app-server[28230]: time=“2019-09-25T14:58:32Z” le
vel=info msg=“starting LoRa App Server” docs=“https://www.loraserver.io/” version=3.3.
1
Sep 25 14:58:32 ip-172-26-15-28 lora-app-server[28230]: time=“2019-09-25T14:58:32Z” le
vel=info msg=“storage: setting up storage package”
Sep 25 14:58:32 ip-172-26-15-28 lora-app-server[28230]: time=“2019-09-25T14:58:32Z” le
vel=info msg=“storage: setting up Redis pool”
Sep 25 14:58:32 ip-172-26-15-28 lora-app-server[28230]: time=“2019-09-25T14:58:32Z” le
vel=info msg=“storage: connecting to PostgreSQL database”
Sep 25 14:58:32 ip-172-26-15-28 lora-app-server[28230]: time=“2019-09-25T14:58:32Z” le
vel=info msg=“storage: applying PostgreSQL data migrations”
Sep 25 14:58:32 ip-172-26-15-28 lora-app-server[28230]: time=“2019-09-25T14:58:32Z” le
vel=fatal msg=“setup storage error: storage: applying PostgreSQL data migrations error
: Unable to create migration plan because of 0002_node_frame_log.sql: unknown migratio
n in database”

I googled and it states that i have to use 2 different database names.i assume it is for dsn. please help!!!

I think you might have used initially the same database as the error tells you there is an unknown migration in the database. Best thing to do is drop and re-create the databases to make sure you start with an empty database.

1 Like

I have the error “unknown migration in database” with the new release 3.11 of the NS.
NB : The previous release 3.10 works well on my computer.

C:\>chirpstack-network-server.exe
time="2020-11-22T15:01:40+01:00" level=info msg="starting ChirpStack Network Server" band=EU868 docs="https://www.chirpstack.io/" net_id=000000 version=3.11.0
time="2020-11-22T15:01:40+01:00" level=info msg="storage: setting up storage module"
time="2020-11-22T15:01:40+01:00" level=info msg="storage: setting up Redis client"
time="2020-11-22T15:01:40+01:00" level=info msg="storage: connecting to PostgreSQL"
time="2020-11-22T15:01:40+01:00" level=info msg="storage: applying PostgreSQL data migrations"
time="2020-11-22T15:01:40+01:00" level=fatal msg="setup storage error: storage: applying PostgreSQL data migrations error: Unable to create migration plan because of 0002_join_accept_params.sql: unknown migration in database"

You are pointing the ChirpStack Network Server potentially to the wrong database. The 0002_join_accept_params.sql migration is part of the ChirpStack Application Server: https://github.com/brocaar/chirpstack-application-server/blob/master/migrations/0002_join_accept_params.sql

Make sure your NS and AS instance are using separate databases.

1 Like