12 Commits

Author SHA1 Message Date
Natalie Tay
1805184cde
FIX: Multiple topics may have the same post as its solution (#348)
We are seeing some errors when migrating and adding indexes on `answer_post_id`.

```
#<StandardError:"An error has occurred, all later migrations canceled:\n\nPG::UniqueViolation: ERROR:  could not create unique index \"index_discourse_solved_solved_topics_on_answer_post_id\"\nDETAIL:  Key (answer_post_id)=(13006) is duplicated.\n">
```

This PR modifies the earlier migration, and also adds one before the addition of indexes to remove duplicates.
2025-03-26 22:21:32 +08:00
Natalie Tay
e0a579e69e
FIX: Migration was only done for first batch (#344)
https://github.com/discourse/discourse-solved/pull/342 was deployed and observed to only have 5000 (batch size) migrated. This is an error in migration where the ids had a gap between the batch.

This PR changes the migration to just loop through all topic custom fields with each loop increasing by batch size.
2025-03-25 17:06:22 +08:00
Natalie Tay
55c1eb4d60
DEV: Move solved custom fields into a table (#342)
Related: 
- https://github.com/discourse/discourse-solved/pull/309
- https://github.com/discourse/discourse-solved/pull/341

Requires:
- https://github.com/discourse/discourse/pull/31954

This commit converts all use of post and topic custom fields into a dedicated table:
- migration for copying custom field into table
- swap app usage of custom fields to table

This commit does not attempt to fix issues or optimise, and does not delete old data from custom fields _yet_.
2025-03-25 14:51:32 +08:00
Roman Rizzi
5450a5ef4e
DEV: Promote historical post-deploy migrations (#331) 2025-01-24 11:48:56 -03:00
David Taylor
14e0800a29
DEV: Introduce syntax_tree for ruby formatting (#217) 2022-12-23 20:36:08 +00:00
Bianca Nenciu
d07ffb6f7a
DEV: Promote historic post_deploy migrations (#216)
This commit promotes all post_deploy migrations which existed in
Discourse v2.8.0 (timestamp <= 20220107014925)
2022-12-19 17:28:01 +02:00
Gerhard Schlager
d6c8089ca3 FIX: Use generic, static names for badges
This is necessary, because seeding badges with a translated name will result in duplicate badges whenever the default locale changes. The static name solves this.
Moreover, it's not necessary to set the description during seeding. The serializer will localize the names and descriptions at runtime.

The DB migration tries to rename the existing badges by looking them up by their translated time.
2022-11-23 11:07:49 +01:00
Mark VanLandingham
52d4656011
Re-add usage of add_directory_column for user directory table solutions count (#140) 2021-06-22 13:18:23 -05:00
Mark VanLandingham
7351882171
Revert "Use add_directory_column API to add solutions count to user directory (#137)" (#139)
This reverts commit 58c594fdda0a8c35a6f52079e1d8909619f6e2df.
2021-06-17 12:37:29 -05:00
Mark VanLandingham
58c594fdda
Use add_directory_column API to add solutions count to user directory (#137) 2021-06-17 09:31:11 -05:00
Martin Brennan
2b12658978
FIX: Add min/max values for auto close hours (#121)
* Also add migration to cap current site settings for
solved_topics_auto_close_hours
  to the max of 175000 if they are too high
2021-02-18 13:49:39 +10:00
Joffrey JAFFEUX
c0f8e2eee0
FIX: applies a unique index for accepted_answer_post_id custom field (#83) 2019-12-12 12:00:28 +01:00