Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

there is no unique constraint matching given keys for referenced table "access_tokens" #10691

@Kokokokoka

Description

@Kokokokoka

Before creating
CREATE TABLE IF NOT EXISTS event_txn_id

create unique index if not exists access_tokens_id on access_tokens (id);
shall be made in order to progress properly.

Description

021-08-25 08:13:51,996 - synapse.storage.prepare_database - 471 - DEBUG - main - Found file: 58/19instance_map.sql.postgres (/opt/venvs/matrix-synapse/lib/python3.9/site-packages/synapse/storage/schema/main/delta/58/19instance_map.sql.postgres)
2021-08-25 08:13:51,996 - synapse.storage.prepare_database - 516 - INFO - main - Applying engine-specific schema 58/19instance_map.sql.postgres
2021-08-25 08:13:51,996 - synapse.storage.SQL - 311 - DEBUG - main - [SQL] {prepare_database} CREATE TABLE IF NOT EXISTS instance_map ( instance_id SERIAL PRIMARY KEY, instance_name TEXT NOT
NULL )
2021-08-25 08:13:52,000 - synapse.storage.SQL - 337 - DEBUG - main - [SQL time] {prepare_database} 0.003949 sec
2021-08-25 08:13:52,001 - synapse.storage.SQL - 311 - DEBUG - main - [SQL] {prepare_database} CREATE UNIQUE INDEX IF NOT EXISTS instance_map_idx ON instance_map(instance_name)
2021-08-25 08:13:52,002 - synapse.storage.SQL - 337 - DEBUG - main - [SQL time] {prepare_database} 0.001419 sec
2021-08-25 08:13:52,002 - synapse.storage.SQL - 311 - DEBUG - main - [SQL] {prepare_database} INSERT INTO applied_schema_deltas (version, file) VALUES (?,?)
2021-08-25 08:13:52,002 - synapse.storage.SQL - 316 - DEBUG - main - [SQL values] {prepare_database} (58, '58/19instance_map.sql.postgres')
2021-08-25 08:13:52,003 - synapse.storage.SQL - 337 - DEBUG - main - [SQL time] {prepare_database} 0.000190 sec
2021-08-25 08:13:52,003 - synapse.storage.prepare_database - 471 - DEBUG - main - Found file: 58/19txn_id.sql (/opt/venvs/matrix-synapse/lib/python3.9/site-packages/synapse/storage/schema/main/delta/58/19txn_id.sql)
2021-08-25 08:13:52,003 - synapse.storage.prepare_database - 508 - INFO - main - Applying schema 58/19txn_id.sql
2021-08-25 08:13:52,003 - synapse.storage.SQL - 311 - DEBUG - main - [SQL] {prepare_database} CREATE TABLE IF NOT EXISTS event_txn_id ( event_id TEXT NOT NULL, room_id TEXT NOT NULL, user_id
TEXT NOT NULL, token_id BIGINT NOT NULL, txn_id TEXT NOT NULL, inserted_ts BIGINT NOT NULL, FOREIGN KEY (event_id) REFERENCES events (event_id) ON DELETE CASCADE, FOREIGN KEY (token_id) REFERENCES access_tokens (id) ON DELETE CASCADE )
2021-08-25 08:13:52,012 - synapse.storage.SQL - 333 - DEBUG - main - [SQL FAIL] {prepare_database} there is no unique constraint matching given keys for referenced table "access_tokens"

Aug 25 07:57:17 Matrix matrix-synapse[190116]: Error during initialisation:
Aug 25 07:57:17 Matrix matrix-synapse[190116]: there is no unique constraint matching given keys for referenced table "access_tokens"

Steps to reproduce

  1. copy db from synapse 1.0 to 1.4
  2. start server

Version information

Synapse: 1.40,
on Debian 11,
using matrix repo.
This is a migration from 1.0 version

Metadata

Metadata

Assignees

Labels

S-MinorBlocks non-critical functionality, workarounds exist.T-DefectBugs, crashes, hangs, security vulnerabilities, or other reported issues.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions