Skip to content

Commit

Permalink
Merge branch '21.x' into feat/unique
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage authored Dec 4, 2024
2 parents 7888b6c + 151f862 commit 911f4c2
Show file tree
Hide file tree
Showing 78 changed files with 2,022 additions and 578 deletions.
1 change: 1 addition & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: test
on:
- push
- pull_request
- workflow_call

jobs:
lint:
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Sync labels
on:
workflow_dispatch:
permissions:
issues: write
jobs:
labels:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: EndBug/label-sync@v2
with:
config-file: 'https://raw.githubusercontent.com/thetutlage/static/main/labels.yml'
delete-other-labels: true
token: ${{ secrets.GITHUB_TOKEN }}
32 changes: 32 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: release
on: workflow_dispatch
permissions:
contents: write
id-token: write
jobs:
checks:
uses: ./.github/workflows/checks.yml
release:
needs: checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
- name: git config
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- name: Init npm config
run: npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: npm install
- run: npm run release -- --ci
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ We encourage you to read the [contribution guide](https://github.com/adonisjs/.g
Easiest way to run tests is to launch the redis cluster using docker-compose and `docker-compose.yml` file.

```sh
docker-compose up
docker-compose up -d
npm run test
```

Expand Down
2 changes: 1 addition & 1 deletion commands/db_seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default class DbSeed extends BaseCommand {
startApp: true,
}

private declare seeder: SeedsRunner
declare private seeder: SeedsRunner

/**
* Track if one or more seeders have failed
Expand Down
4 changes: 2 additions & 2 deletions commands/db_truncate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default class DbTruncate extends BaseCommand {
/**
* Prompts to take consent when truncating the database in production
*/
private async takeProductionConstent(): Promise<boolean> {
private async takeProductionConsent(): Promise<boolean> {
const question = 'You are in production environment. Want to continue truncating the database?'
try {
return await this.prompt.confirm(question)
Expand Down Expand Up @@ -78,7 +78,7 @@ export default class DbTruncate extends BaseCommand {
*/
let continueTruncate = !this.app.inProduction || this.force
if (!continueTruncate) {
continueTruncate = await this.takeProductionConstent()
continueTruncate = await this.takeProductionConsent()
}

/**
Expand Down
4 changes: 2 additions & 2 deletions commands/db_wipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default class DbWipe extends BaseCommand {
/**
* Prompts to take consent when wiping the database in production
*/
private async takeProductionConstent(): Promise<boolean> {
private async takeProductionConsent(): Promise<boolean> {
const question = 'You are in production environment. Want to continue wiping the database?'
try {
return await this.prompt.confirm(question)
Expand Down Expand Up @@ -141,7 +141,7 @@ export default class DbWipe extends BaseCommand {
*/
let continueWipe = !this.app.inProduction || this.force
if (!continueWipe) {
continueWipe = await this.takeProductionConstent()
continueWipe = await this.takeProductionConsent()
}

/**
Expand Down
2 changes: 1 addition & 1 deletion commands/migration/_base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default abstract class MigrationsBase extends BaseCommand {
/**
* Prompts to take consent for running migrations in production
*/
protected async takeProductionConstent(): Promise<boolean> {
protected async takeProductionConsent(): Promise<boolean> {
const question = 'You are in production environment. Want to continue running migrations?'
try {
return await this.prompt.confirm(question)
Expand Down
10 changes: 10 additions & 0 deletions commands/migration/refresh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ export default class Refresh extends BaseCommand {
@flags.boolean({ description: 'Run seeders' })
declare seed: boolean

/**
* Display migrations result in one compact single-line output
*/
@flags.boolean({ description: 'A compact single-line output' })
declare compactOutput: boolean

/**
* Disable advisory locks
*/
Expand All @@ -60,6 +66,10 @@ export default class Refresh extends BaseCommand {
args.push('--force')
}

if (this.compactOutput) {
args.push('--compact-output')
}

if (this.connection) {
args.push(`--connection=${this.connection}`)
}
Expand Down
10 changes: 10 additions & 0 deletions commands/migration/reset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ export default class Reset extends BaseCommand {
@flags.boolean({ description: 'Do not run actual queries. Instead view the SQL output' })
declare dryRun: boolean

/**
* Display migrations result in one compact single-line output
*/
@flags.boolean({ description: 'A compact single-line output' })
declare compactOutput: boolean

/**
* Disable advisory locks
*/
Expand All @@ -54,6 +60,10 @@ export default class Reset extends BaseCommand {
args.push('--force')
}

if (this.compactOutput) {
args.push('--compact-output')
}

if (this.connection) {
args.push(`--connection=${this.connection}`)
}
Expand Down
13 changes: 11 additions & 2 deletions commands/migration/rollback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default class Rollback extends MigrationsBase {
/**
* Force run migrations in production
*/
@flags.boolean({ description: 'Explictly force to run migrations in production' })
@flags.boolean({ description: 'Explicitly force to run migrations in production' })
declare force: boolean

/**
Expand All @@ -52,6 +52,14 @@ export default class Rollback extends MigrationsBase {
})
declare batch: number

/**
* Define custom step, instead of rolling back to the latest batch
*/
@flags.number({
description: 'The number of migrations to be reverted',
})
declare step: number

/**
* Display migrations result in one compact single-line output
*/
Expand All @@ -74,6 +82,7 @@ export default class Rollback extends MigrationsBase {
direction: 'down',
connectionName: this.connection,
batch: this.batch,
step: this.step,
dryRun: this.dryRun,
disableLocks: this.disableLocks,
})
Expand All @@ -93,7 +102,7 @@ export default class Rollback extends MigrationsBase {
*/
let continueMigrations = !this.app.inProduction || this.force
if (!continueMigrations) {
continueMigrations = await this.takeProductionConstent()
continueMigrations = await this.takeProductionConsent()
}

/**
Expand Down
2 changes: 1 addition & 1 deletion commands/migration/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export default class Migrate extends MigrationsBase {
*/
let continueMigrations = !this.app.inProduction || this.force
if (!continueMigrations) {
continueMigrations = await this.takeProductionConstent()
continueMigrations = await this.takeProductionConsent()
}

/**
Expand Down
6 changes: 2 additions & 4 deletions docker-compose.yml → compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.8'

services:
legacy_mysql:
platform: linux/x86_64
Expand Down Expand Up @@ -48,7 +46,7 @@ services:
- $LEGACY_MYSQL_READ_REPLICA_PORT

pg:
image: postgres:11
image: postgres:16
container_name: pg
env_file: ./.env
environment:
Expand All @@ -61,7 +59,7 @@ services:
- $PG_PORT

pg_read_replica:
image: postgres:11
image: postgres:16
container_name: pg_read_replica
env_file: ./.env
environment:
Expand Down
7 changes: 6 additions & 1 deletion configure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ export async function configure(command: Configure) {
if (dialect === undefined) {
dialect = await command.prompt.choice(
'Select the database you want to use',
Object.keys(DIALECTS),
Object.keys(DIALECTS).map((dialectKey) => {
return {
name: dialectKey,
message: DIALECTS[dialectKey as keyof typeof DIALECTS].name,
}
}),
{
validate(value) {
return !!value
Expand Down
2 changes: 2 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import { configPkg } from '@adonisjs/eslint-config'
export default configPkg()
Loading

0 comments on commit 911f4c2

Please sign in to comment.