fix(plugin-workflow): fix migration on table prefix (#1478)

* fix(plugin-workflow): fix migration on table prefix

* fix(plugin-workflow): fix migration version check

* fix: ci

---------

Co-authored-by: chenos <chenlinxh@gmail.com>
This commit is contained in:
Junyi 2023-02-22 12:05:59 +08:00 committed by GitHub
parent dcc29892e6
commit 944f327212
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 11 deletions

View File

@ -23,6 +23,7 @@ PROXY_TARGET_URL=
DB_DIALECT=sqlite
DB_STORAGE=storage/db/nocobase.sqlite
DB_TABLE_PREFIX=
# DB_HOST=localhost
# DB_PORT=5432
# DB_DATABASE=postgres

View File

@ -12,11 +12,10 @@ on:
- 'packages/**'
jobs:
sqlite-test:
build-test:
strategy:
matrix:
node_version: ['16', '18']
underscored: [true, false]
runs-on: ubuntu-latest
container: node:${{ matrix.node_version }}
steps:
@ -28,6 +27,23 @@ jobs:
cache: 'yarn'
- run: yarn install
- run: yarn build
sqlite-test:
strategy:
matrix:
node_version: ['18']
underscored: [true, false]
runs-on: ubuntu-latest
container: node:${{ matrix.node_version }}
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node_version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node_version }}
cache: 'yarn'
- run: yarn install
# - run: yarn build
- name: Test with Sqlite
run: yarn test
env:
@ -38,7 +54,7 @@ jobs:
postgres-test:
strategy:
matrix:
node_version: ['16', '18']
node_version: ['18']
underscored: [true, false]
schema: [public, nocobase]
runs-on: ubuntu-latest
@ -66,7 +82,7 @@ jobs:
node-version: ${{ matrix.node_version }}
cache: 'yarn'
- run: yarn install
- run: yarn build
# - run: yarn build
- name: Test with postgres
run: yarn test
env:
@ -82,7 +98,7 @@ jobs:
mysql-test:
strategy:
matrix:
node_version: ['16', '18']
node_version: ['18']
underscored: [true, false]
runs-on: ubuntu-latest
container: node:${{ matrix.node_version }}
@ -101,7 +117,7 @@ jobs:
node-version: ${{ matrix.node_version }}
cache: 'yarn'
- run: yarn install
- run: yarn build
# - run: yarn build
- name: Test with MySQL
run: yarn test
env:

View File

@ -4,23 +4,24 @@ import { Migration } from '@nocobase/server';
export default class extends Migration {
async up() {
const match = await this.app.version.satisfies('<=0.9.0-alpha.2');
const match = await this.app.version.satisfies('<0.9.0-alpha.3');
if (!match) {
return;
}
const { context: { sequelize, queryInterface } } = arguments[0];
const { db } = this.app;
await sequelize.transaction(async (transaction) => {
await queryInterface.changeColumn('workflows', 'config', {
await queryInterface.changeColumn(db.getCollection('workflows').model.getTableName(), 'config', {
type: DataTypes.JSON
}, { transaction });
await queryInterface.changeColumn('flow_nodes', 'config', {
await queryInterface.changeColumn(db.getCollection('flow_nodes').model.getTableName(), 'config', {
type: DataTypes.JSON
}, { transaction });
await queryInterface.changeColumn('executions', 'context', {
await queryInterface.changeColumn(db.getCollection('executions').model.getTableName(), 'context', {
type: DataTypes.JSON
}, { transaction });
await queryInterface.changeColumn('jobs', 'result', {
await queryInterface.changeColumn(db.getCollection('jobs').model.getTableName(), 'result', {
type: DataTypes.JSON
}, { transaction });
});