Commit Graph
43 Commits
Author SHA1 Message Date
Martin Brennan 7121cfd4ab FEATURE: User preference for editor Markdown monospace font (#34051)
This commit responds to feedback in the Discourse Meta discussion

https://meta.discourse.org/t/monospace-font-in-the-markdown-only-editor/359936

This change introduces a user preference that allows users to choose
whether the Markdown editor uses a monospace font. The default setting
is `true` for new sites, but set to `false` for existing sites to avoid
disrupting current users' experiences.

Admins can change the `default_other_enable_markdown_monospace_font`
site setting to manage this for all users.
2025-08-04 14:56:21 +10:00
Martin Brennan 6f92b20486 DEV: Drop old enable_experimental_sidebar user option (#34052)
This is no longer used anywhere in the codebase.
2025-08-04 13:48:57 +10:00
Selase Krakani ea5b5b6c00 DEV: Add muted_users converter and importer steps (#33709)
This adds converter(Discourse-only, for now) and importer steps for
muted_users
2025-07-28 11:35:24 +00:00
Selase Krakani e05582ab5d DEV: Add group_users converter and importer steps (#33687)
This adds converter(Discourse-only, for now) and importer steps for
`group_users`
2025-07-28 11:08:54 +00:00
Selase Krakani a5c0326da1 DEV: Add groups converter and importer steps (#33373)
This adds converter(Discourse-only, for now) and importer steps for
`groups`
2025-07-28 10:42:30 +00:00
Selase Krakani 57a04e7ec8 DEV: SetStore backed implementation of requires_set (#33626)
This change updates `requires_set` internals to use our custom set
implementations via `Migrations::SetStore`
2025-07-28 10:41:46 +00:00
Gerhard Schlager 53d7a756d6 DEV: Add Migrations::SetStore to work with nested sets of data (#33593)
There are concrete implementations for a simple set, a key-value store,
and nested sets with 2 or 3 keys. The API stays the same for all
implementations and the performances is more or less the same as without
the wrapper (at least with YJIT enabled).
2025-07-24 12:11:41 +02:00
Gerhard Schlager bb7afcf2a1 DEV: Add newly promoted core plugins to IntermediateDB config (#33798) 2025-07-24 12:10:37 +02:00
Selase Krakani 53c557ff6c DEV: Add custom_category_fields converter and importer steps (#33362)
This adds converter(Discourse-only, for now) and importer steps for
`category_custom_fields`
2025-07-24 00:20:46 +00:00
Selase Krakani acb23b5b4a DEV: Add newly promoted core plugins to intermediate DB config (#33654)
Update `intermedate_db.yml` config with newly promoted core plugins
names and tables to the intermediate DB config.

It also updates the existing `user_options` table with the newly
introduced `notification_level_when_assigned` column.
2025-07-16 17:33:51 +00:00
Selase Krakani 8253b14732 DEV: Add category_users converter and importer steps (#33367)
This adds converter(Discourse-only, for now) and importer steps for
`category_users`
2025-07-15 13:21:50 +00:00
Selase Krakani 5ad072aab4 DEV: Add categories converter and importer steps (#33067)
This adds a converter (Discourse only, for now) and importer steps for categories, along with a category upload references import step.
2025-06-26 16:37:24 +02:00
Gerhard SchlagerandSelase Krakani c79c1d63d0 DEV: Import user avatars from IntermediateDB (#33319)
This also enhances the converter step, which stores the Gravatar if it is
set and used. It also fixes the import of uploads which didn't use the
correct user ID.

---------

Co-authored-by: Selase Krakani <849886+s3lase@users.noreply.github.com>
2025-06-25 23:37:27 +02:00
Selase Krakani 404dcc7623 DEV: Add badges converter and importer steps (#33019)
This adds converter(just Discourse for now) and importer steps for
`badges`
2025-06-25 13:15:24 +02:00
Gerhard Schlager 2fa0dc58d4 DEV: Allow multiple users to have the same email in IntermediateDB (#33318)
The import script will merge the users based on email
2025-06-24 22:59:00 +02:00
Gerhard Schlager b31189e0b4 DEV: Add --reset option to import command (#33317)
It deletes the MappingDB before executing the import. That's useful
during development when you repeat the import multiple times.
2025-06-24 22:58:32 +02:00
Gerhard Schlager 95f4460394 DEV: Import uploads from UploadsDB (#33259) 2025-06-20 22:59:57 +02:00
Gerhard Schlager a51fb04864 DEV: Store avatar in users converter step (#33176) 2025-06-20 22:59:36 +02:00
Selase Krakani d304e708be FIX: Stop silently dropping first two rows during load_mapping (#33076)
Currently, the first two rows returned by `DiscourseDB#query_array` are
silently dropped during the column size check in
`DiscourseDB#load_mapping`. This happens because the rows object, while
an enumerator, isn't fully compliant, it doesn't rewind during
introspection. As a result, calls like `#first`, `#peek`, or `#any?`
advance the iterator.

Ideally, we’d fix this by updating the `query_array` enumeration
implementation. However, customizing the enumerator to be fully
compliant would likely introduce unnecessary perf overhead for all use
cases. So, this fix works around that limitation by building the map a
little differently.
2025-06-09 23:26:59 +02:00
Selase Krakani 631d2e3369 FIX: Exclude reviewable_notes from intermediate DB schema (#33068) 2025-06-04 10:31:28 +08:00
Selase KrakaniandGerhard Schlager a48f33fda0 FIX: Ensure copy_data callbacks run even when all rows are skipped (#33002)
Currently, if a batch "copy" of an import step results in all rows being
skipped, the `after_commit_of_skipped_rows` callback is never triggered.
This happens because the callback is nested inside a block that only
runs when at least one row is inserted.

This change ensures the DB copy operation returns both inserted and
skipped rows, allowing the caller to respond appropriately in either
case.

---------

Co-authored-by: Gerhard Schlager <gerhard.schlager@discourse.org>
2025-06-02 23:07:28 +02:00
Selase Krakani 9f1dda2f02 DEV: Require created_at on users (#33033)
Add a table-level override to require `created_at` on `users` table
2025-06-02 14:08:38 +00:00
Selase KrakaniandGerhard Schlager c31035caf5 DEV: Support nullable column property modification (#32978)
By default, rails makes timestamp columns (`created_at` and
`updated_at`) non-nullable, we also have some required core and plugins
columns we wouldn't necessarily want to enforce in the intermediate DB
schema. It'll be better to set the default values for these during
import instead of enforcing these at the converter level.

This change adds support for globally modifying a column’s `nullable`
state, defaulting all `created_at` columns to be `nullable` while
allowing for table level overrides.

---------

Co-authored-by: Gerhard Schlager <gerhard.schlager@discourse.org>
2025-06-01 22:39:18 +00:00
Gerhard Schlager fc9946f595 DEV: Add converter & importer for permalink_normalizations 2025-05-31 22:17:44 +02:00
Gerhard Schlager 58a01d1e03 DEV: Check if IntermediateDB schema is valid (#32975) 2025-05-29 22:08:50 +02:00
Gerhard Schlager 233c54b7fc DEV: Small API changes for interacting with PG during migrations (#32976) 2025-05-29 22:08:32 +02:00
Selase Krakani ee4cb3915e FIX: Composite primary key output (#32972)
Ensure last column definition before a composite primary key definition
has a comma.
2025-05-28 17:45:48 +00:00
Alan Guo Xiang Tan 5601b73e7a DEV: Fix broken migration tests (#32525) 2025-04-30 12:55:00 +08:00
Gerhard Schlager 251cac39af DEV: Adds a basic importer for the IntermediateDB
* It only imports users and emails so far
* It stores mapped IDs and usernames in a SQLite DB. In the future, we might want to copy those into the Discourse DB at the end of a migration.
* The importer is split into steps which can mostly be configured with a simple DSL
* Data that needs to be shared between steps can be stored in an instance of the `SharedData` class
* Steps are automatically sorted via their defined dependencies before they are executed
* Common logic for finding unique names (username, group name) is extracted into a helper class
* If possible, steps try to avoid loading already imported data (via `mapping.ids` table)
* And steps should select the `discourse_id` instead of the `original_id` of mapped IDs via SQL
2025-04-07 17:22:36 +02:00
Gerhard Schlager 7c6b116dfd DEV: Adds a new converter for migrating from Discourse
It only contains a few user-related steps right now
2025-04-07 17:22:36 +02:00
Gerhard Schlager 17ba19c7ae REFACTOR: Code generator for migrations IntemerdiateDB
* Splits the existing script into multiple classes
* Adds command for generating IntermediateDB schema (`migrations/bin/cli schema generate`)
* Changes the syntax of the IntermediateDB schema config
* Adds validation for the schema config
* It uses YAML schema aka JSON schema to validate the config file
* It generates the SQL schema file and Ruby classes for storing data in the IntermediateDB
2025-04-07 17:22:36 +02:00
Gerhard Schlager 71a90dcba2 DEV: Refactor migrations-tooling
* Updates GitHub Action for migrations
* Rubocop: Always `EnforcedShorthandSyntax` for hashes in the `migrations` directory
* Automatically load all available converter steps
* Enable YJIT at runtime, if available
* Progressbar shows skipped records and other small improvements
2025-04-07 17:22:36 +02:00
Gerhard Schlager 2d05a82f52 DEV: Add Upload to IntermediateDB (#29780) 2025-01-20 23:16:30 +01:00
Gerhard Schlager 5ac69076c1 REFACTOR: Simplify converter steps in migration tooling (#29779)
* Remove unused `report_progress_in_percent` option from step
* Remove `use_custom_progress_increment` option from the step because we can figure it out by looking at the progress
* Introduce `StepTracker` to for logging warnings and errors and tracking step progress
* Make it easier to log warnings and errors in all methods of `Step` without the need to pass around a `stats` object
2024-11-19 23:54:37 +01:00
Gerhard Schlager a48af2f120 DEV: Store details log entries in converter as JSON (#29778)
Plus small DB related fixes
2024-11-19 23:54:00 +01:00
Gerhard Schlager 75f4a14568 FIX: migrations-tooling CLI didn't work anymore (#29777)
The previous approach of splitting Thor commands into multiple files caused problems when the same method name was used in multiple commands.

This also loads the Rails environment only for commands that need it. That makes the CLI boot faster for most commands or when the help should be shown. That's also why we can't use `Rails.root` in the CLI.
2024-11-19 23:51:53 +01:00
Selase Krakani 6c91148db8 DEV: Refactor uploads_importer script (#29292)
* DEV: Implement uploads command entrypoint

- Setup Thor UploadsCommand for CLI
- First pass at modularizing various parts of the exising `uploads_import` script

* DEV: First attempt at modularizing missing uploads fixer task

Move missing upload fix to a dedicated uploads task implementation unit

* DEV: First attempt at modularizing missing uploads uploader task

Move uploader to a dedicated uploads task implementation unit

* DEV: First attempt at modularizing missing uploads optimizer task

Move optimizer to a dedicated uploads task implementation unit

* DEV: Various follow up fixes to get optimization working

- Start threads early
- Improve "log" message formatting
- Add missing `copy_to_tempfile` method on "uploader" task

* DEV: Refactor a bit more

Deduplicate and move most of threading premitives to base task as-is

* DEV: Remove redundant condition in uploads db migration

* DEV: More deduplication

Move task retry logic to base class and tidy up other implementation
details carried over from the existing script
2024-10-31 13:31:12 +00:00
Gerhard Schlager 7c3a29c9d6 DEV: Add converter framework for migrations-tooling (#28540)
* Updates GitHub Actions
* Switches from `bundler/inline` to an optional group in the `Gemfile` because the previous solution didn't work well with rspec
* Adds the converter framework and tests
* Allows loading private converters (see README)
* Switches from multiple CLI tools to a single CLI
* Makes DB connections reusable and adds a new abstraction for the `IntermediateDB`
* `IntermediateDB` acts as an interface for IPC calls when a converter steps runs in parallel (forks). Only the main process writes to the DB.
* Includes a simple example implementation of a converter for now.
2024-09-09 17:14:39 +02:00
Loïc Guitaut 2a28cda15c DEV: Update to lastest rubocop-discourse 2024-05-27 18:06:14 +02:00
Gerhard Schlager d286c1d5a1 DEV: Prepare new structure for migrations-tooling (#26631)
* Moves existing files around. All essential scripts are in `migrations/bin`, and non-essential scripts like benchmarks are in `migrations/scripts`
* Dependabot configuration for migrations-tooling (disabled for now)
* Updates test configuration for migrations-tooling
* Shorter configuration for intermediate DB for now. We will add the rest table by table.
* Adds a couple of benchmark scripts
* RSpec setup especially for migrations-tooling and the first tests
* Adds sorting/formatting to the `generate_schema` script
2024-04-15 18:47:40 +02:00
Jarek Radosz 3736d66f17 DEV: Extensively use exception: true in system() (#25911)
Specifically fixes a bug in smoke-test where it would just move on after failing to install latest js dependencies with yarn.
2024-02-27 11:33:28 +01:00
Selase Krakani 93264da206 DEV: Add script to generate schema for intermediate DB (#24484)
This will be used by migration scripts.
2024-01-22 18:45:52 +01:00
Gerhard Schlager e16537fa9f DEV: Add initial structure for migrations-tooling 2023-10-13 16:03:55 +02:00