Intenté actualizar el foro Discourse a la última versión 2.2.0.beta5 en la instancia de prueba, pero falló.
El error es:
I, INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate'
rake aborted!
StandardError: Ha ocurrido un error, esta y todas las migraciones posteriores se cancelaron:
PG::UniqueViolation: ERROR: el valor de clave duplicado viola la restricción única "index_polls_on_post_id_and_name"
DETALLE: La clave (post_id, name)=(662593, poll) ya existe.
Ingresé a la base de datos PostgreSQL y verifiqué que no hay valores en la tabla polls, por lo que es extraño que recibamos el error: "La clave (post_id, name)=(662593, poll) ya existe.":
= > SELECT * FROM polls;
id | post_id | name | close_at | type | status | results | visibility | min | max | step | anonymous_voters | created_at | updated_at
----+---------+------+----------+------+--------+---------+------------+-----+-----+------+------------------+------------+------------
(0 filas)
= > \d polls_id_seq
Secuencia "public.polls_id_seq"
Columna | Tipo | Valor
---------------+---------+---------------------
sequence_name | name | polls_id_seq
last_value | bigint | 4524
start_value | bigint | 1
increment_by | bigint | 1
max_value | bigint | 9223372036854775807
min_value | bigint | 1
cache_value | bigint | 1
log_cnt | bigint | 24
is_cycled | boolean | f
is_called | boolean | t
Propiedad de: public.polls.id
= > select count(id),max(id) from polls;
count | max
-------+-----
0 |
(1 fila)
¿Podrían, por favor, ayudarme con este problema?
Debido a este error, no podemos actualizar el foro Discourse.
Can someone from development team take a look to this question ?
We are blocked with update of Discourse forum to the latest version, because of this error.
And also we cannot install additional plugin, as docker container is not compiled and as a result is not running.
It turns out that the problem was that the poll had been duplicated in a quote block, and the migration didn’t know to ignore it. It was in a PM, apparently as an example of how polls worked. I deleted the duplicate and the migration ran fine.