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
This commit is contained in:
Gerhard Schlager
2024-04-15 18:47:40 +02:00
committed by GitHub
parent 831da05103
commit d286c1d5a1
34 changed files with 1287 additions and 396 deletions

View File

@ -0,0 +1,22 @@
## Gemfiles for migrations-tooling
This directory contains Gemfiles for the migration related tools.
Those tools use `bundler/inline`, so this isn't strictly needed. However, we use GitHub's Dependabot to keep the
dependencies up-to-date, and it requires a Gemfile to work. Also, it's easier to test the tools with a Gemfile.
Please add an entry in the `.github/workflows/dependabot.yml` file when you add a new Gemfile to enable Dependabot for
the Gemfile.
#### Example
```yaml
- package-ecosystem: "bundler"
directory: "migrations/config/gemfiles/convert"
schedule:
interval: "weekly"
day: "wednesday"
time: "10:00"
timezone: "Europe/Vienna"
versioning-strategy: "increase"
```

View File

@ -0,0 +1,26 @@
# frozen_string_literal: true
source "https://rubygems.org"
# the minimal Ruby version required by migration-tooling
ruby ">= 3.2.2"
# `activesupport` gem needs to be in sync with the Rails version of Discourse, see `/Gemfile`
gem "activesupport", "< 7.1", require: "active_support"
# for SQLite
gem "extralite-bundle",
"~> 2.8",
require: "extralite",
github: "digital-fabric/extralite"
gem "lru_redux", "~> 1.1", require: false
# for communication between process forks
gem "msgpack", "~> 1.7"
# for CLI
gem "colored2", "~> 4.0"
gem "thor", "~> 1.3"
# auto-loading
gem "zeitwerk", "~> 2.6"

View File

@ -0,0 +1,50 @@
## Configuration options for the base intermediate schema generator
##
## After modifying this file, regenerate the base intermediate schema
## by running the `generate_schema` script.
# Default relative path for generated base schema file.
# An absolute path can also be provided to the script as the first CLI argument.
# If the CLI argument is present, it takes precedence over the value specified here.
output_file_path: "../db/schema/100-base-schema.sql"
## Tables to include in the generated base intermediate schema.
##
## Available table options:
## virtual: Boolean. Enables the inclusion of a table in the schema solely based.
## on the provided configuration. A virtual table does not need to be available in the core schema.
## ignore: List of columns to ignore. Convenient if most of the table's column are needed.
## Usage is mutually exclusive with the `include` option. Only one should be used at a time.
## include: List of columns to include. Convenient if only a few columns are needed.
## Usage is mutually exclusive with the `include`` option. Only one should be used at a time.
## primary_key: Literal or list of columns to use as primary key.
## extend: List of objects describing columns to be added/extended.
## The following options are available for an "extend" object:
## name: Required. The name of the column being extended.
## is_null: Specifies if the column can be null.
## type: Column type. Defaults to TEXT.
## indexes: List of indexes to create. The following options are available for an "index" object:
## name: Index name.
## columns: List of column(s) to index.
tables:
users:
ignore:
- flag_level
- last_emailed_at
- last_posted_at
- last_seen_reviewable_id
- password_algorithm
- password_hash
- salt
- secure_identifier
- seen_notification_id
- username_lower
## Schema-wide column configuration options. These options apply to all tables.
## See table specific column configuration options above.
##
## Available Options:
## ignore: List of core/plugin table columns to ignore and exclude from intermediate schema.
columns:
ignore:
- updated_at