Skip to content

Repeated migrations on restart #153

@dawidmalina

Description

@dawidmalina

Hi,

I am trying to use the latest image: uraniadev/snapp:latest, but it seems that restarting the application triggers migrations repeatedly. This is inferred from the logs, where the migration process takes a significant amount of time:

[init] Migrations...: 27.802s

Additionally, I noticed the following error in the database container logs:

db-1     | 2026-01-30 11:12:09.477 UTC [92] ERROR:  relation "metric" already exists
db-1     | 2026-01-30 11:12:09.477 UTC [92] STATEMENT:  CREATE TABLE "metric" (
db-1     | 		"browser" text,
db-1     | 		"city" text,
db-1     | 		"country" text,
db-1     | 		"cpu" text,
db-1     | 		"device" text,
db-1     | 		"id" text PRIMARY KEY,
db-1     | 		"language" text,
db-1     | 		"organization_id" text NOT NULL,
db-1     | 		"os" text,
db-1     | 		"owner_id" text NOT NULL,
db-1     | 		"referrer" text,
db-1     | 		"region" text,
db-1     | 		"timestamp" timestamp DEFAULT now() NOT NULL,
db-1     | 		"url_id" text,
db-1     | 		"user_agent" text,
db-1     | 		"utm" jsonb
db-1     | 	);

It seems like the migration process is attempting to recreate the metric table, which already exists, leading to this error.

Could you confirm if this is expected behavior or if there is a way to prevent migrations from running unnecessarily on every restart?

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions