mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 11:11:13 +08:00
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:
22
migrations/config/gemfiles/README.md
Normal file
22
migrations/config/gemfiles/README.md
Normal 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"
|
||||
```
|
26
migrations/config/gemfiles/common/Gemfile
Normal file
26
migrations/config/gemfiles/common/Gemfile
Normal 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"
|
50
migrations/config/intermediate_db.yml
Normal file
50
migrations/config/intermediate_db.yml
Normal 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
|
Reference in New Issue
Block a user