PostgreSQL error: Unable to create migration plan

Hello everyone,
I’ve purchased a RAK7244 and I want to configure it as I did for RAK7243.
In particular, in RAK7243 I installed ChirpStack Gateway Bridge 3.4.1, ChirpStack Network Server 3.4.1 and ChirpStack Applicaton Server 3.5.1.
I cloned the related git repository and I successfully managed to build them.

Now, when I start ChirpStack Network Server I get:

INFO[0000] starting ChirpStack Network Server band=EU868 docs=“https://www.chirpstack.io/” net_id=000000 version=3.4.1
INFO[0000] storage: setting up storage module
INFO[0000] storage: setting up Redis connection pool
INFO[0000] storage: connecting to PostgreSQL
INFO[0000] storage: applying PostgreSQL data migrations
FATA[0000] setup storage error: storage: applying PostgreSQL data migrations error: Unable to create migration plan because of 0025_cleanup_gateway_stats.sql: unknown migration in database

and when I start ChirpStack Application Server I get:

INFO[0000] starting ChirpStack Application Server docs=“https://www.chirpstack.io/” version=3.5.1
INFO[0000] storage: setting up storage package
INFO[0000] storage: setup metrics
INFO[0000] storage: setting up Redis pool
INFO[0000] storage: connecting to PostgreSQL database
INFO[0000] storage: applying PostgreSQL data migrations
FATA[0000] setup storage error: storage: applying PostgreSQL data migrations error: Unable to create migration plan because of 0046_devaddr_appskey_to_device.sql: unknown migration in database

I did not find any solution for that.
Do you have any advice?
Thank you!

Ok I find a solution.

I drop the chirpstack_ns and chirpstack_as databases and created them again.

Here I report the cmd line procedure for other users:

sudo -u postgres psql
drop database chirpstack_ns;
drop database chirpstack_as;
create database chirpstack_ns with owner chirpstack_ns;
create database chirpstack_as with owner chirpstack_as;
\c chirpstack_as;
create extension pg_trgm;
create extension hstore;
\q

1 Like