-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Description
Past Issues Searched
- I have searched open and closed issues to make sure that the bug has not yet been reported
Issue is a Bug Report
- This is a bug report and not a feature request, nor asking for self-hosted support
Using official Plausible Cloud hosting or self-hosting?
Self-hosting
Describe the bug
Upgrading from 2.1.5 to 3.0.0, using the official Docker images (but not the docker-compose as I'm running on Nomad orchestrator). Plausible container fails because of a missing column in teams table
2025-04-11 08:29:42.000 ** (Postgrex.Error) ERROR 42703 (undefined_column) column t1.locked does not exist
2025-04-11 08:29:42.000
2025-04-11 08:29:42.000 query: SELECT t1."id", t1."identifier", t1."name", t1."trial_expiry_date", t1."accept_traffic_until", t1."allow_next_upgrade_override", t1."locked", t1."setup_complete", t1."setup_at", t1."hourly_api_request_limit", t1."notes", t1."grace_period", t1."inserted_at", t1."updated_at" FROM "team_memberships" AS t0 INNER JOIN "teams" AS t1 ON t1."id" = t0."team_id" WHERE ((t0."user_id" = $1) AND (t0."role" = 'owner')) AND (t1."setup_complete" = FALSE) ORDER BY t1."id"
2025-04-11 08:29:42.000 (ecto_sql 3.12.1) lib/ecto/adapters/sql.ex:1096: Ecto.Adapters.SQL.raise_sql_call_error/1
2025-04-11 08:29:42.000 (ecto_sql 3.12.1) lib/ecto/adapters/sql.ex:994: Ecto.Adapters.SQL.execute/6
2025-04-11 08:29:42.000 (ecto 3.12.5) lib/ecto/repo/queryable.ex:232: Ecto.Repo.Queryable.execute/4
2025-04-11 08:29:42.000 (ecto 3.12.5) lib/ecto/repo/queryable.ex:19: Ecto.Repo.Queryable.all/3
2025-04-11 08:29:42.000 (plausible 0.0.1) lib/plausible/teams.ex:332: Plausible.Teams.get_owned_team/2
2025-04-11 08:29:42.000 (plausible 0.0.1) lib/plausible/teams.ex:149: Plausible.Teams.get_or_create/1
2025-04-11 08:29:42.000 (plausible 0.0.1) lib/plausible/data_migration/backfill_teams.ex:443: anonymous fn/2 in Plausible.DataMigration.BackfillTeams.backfill_teams/1
teams table was created, but seems to be missing the locked column. It's like this in my postgres DB
CREATE TABLE public.teams (
id bigserial NOT NULL,
"name" varchar(255) NOT NULL,
trial_expiry_date date NULL,
accept_traffic_until date NULL,
allow_next_upgrade_override bool DEFAULT false NOT NULL,
grace_period jsonb NULL,
inserted_at timestamp(0) NOT NULL,
updated_at timestamp(0) NOT NULL,
setup_complete bool DEFAULT false NOT NULL,
setup_at timestamp(0) NULL,
identifier uuid DEFAULT gen_random_uuid() NOT NULL,
notes text NULL,
hourly_api_request_limit int4 DEFAULT 600 NOT NULL,
CONSTRAINT teams_pkey PRIMARY KEY (id)
);
CREATE UNIQUE INDEX teams_identifier_index ON public.teams USING btree (identifier);
So, I created the missing locked column
ALTER TABLE teams ADD COLUMN locked bool DEFAULT false NOT NULL;
But then plausible complains about the column already existing
2025-04-11 08:44:03.000 ** (Postgrex.Error) ERROR 42701 (duplicate_column) column "locked" of relation "teams" already exists
2025-04-11 08:44:03.000 (ecto_sql 3.12.1) lib/ecto/adapters/sql.ex:1096: Ecto.Adapters.SQL.raise_sql_call_error/1
2025-04-11 08:44:03.000 (elixir 1.18.3) lib/enum.ex:1714: Enum."-map/2-lists^map/1-1-"/2
2025-04-11 08:44:03.000 (ecto_sql 3.12.1) lib/ecto/adapters/sql.ex:1203: Ecto.Adapters.SQL.execute_ddl/4
2025-04-11 08:44:03.000 (ecto_sql 3.12.1) lib/ecto/migration/runner.ex:348: Ecto.Migration.Runner.log_and_execute_ddl/3
2025-04-11 08:44:03.000 (elixir 1.18.3) lib/enum.ex:1714: Enum."-map/2-lists^map/1-1-"/2
2025-04-11 08:44:03.000 (ecto_sql 3.12.1) lib/ecto/migration/runner.ex:311: Ecto.Migration.Runner.perform_operation/3
2025-04-11 08:44:03.000 (stdlib 6.2.2) timer.erl:595: :timer.tc/2
So I removed the locked column, and restarted : everything is now working.
Looks like there's something weird with the order of migration scripts (one is expecting the locked column before it's created)
Expected behavior
plausible should start without error
Screenshots
No response
Environment
- OS: Official Docker images running on Nomad. Postgres server is running version 16.3
- Browser: N/A
- Browser Version: N/ALucaDiba, g0rbe, mjwwit and thematchless
Metadata
Metadata
Assignees
Labels
No labels