nocobase/packages/plugins/duplicator
ChengLei Shao 4f87de7da5
feat: database view collection (#1587)
* test: create view collection

* feat: view collection class

* feat: list view

* chore: skip sync view collection

* test: should create view collection in difference schema

* test: create view collection in collection manager

* feat: create view collection by user sql

* test: view resourcer

* feat: view collection

* feat: view collection cannot be added, deleted, or modified

* feat: view collection cannot be added, deleted, or modified

* feat: view collection cannot be added, deleted, or modified

* feat: view collection cannot be added, deleted, or modified

* refactor: connect to database view

* refactor: sync from database

* chore: rename list view sql

* chore: list view fields api

* chore: create collection without viewName

* feat: bring out fields when selecting a view

* chore: bring out fields when selecting a view

* feat: view field inference class

* chore: bring out fields when selecting a view

* chore: sync form database view

* chore: sync form database view

* refactor: view collection local

* feat: view get api

* feat: database type infer

* feat: integer map

* chore: remove from in view list

* chore: build error

* chore: uniq collection

* fix: typo

* chore: replace collection list source field

* fix: destroy view collection

* chore: timestamp field map

* refactor: interface avalableTypes

* refactor: interface avalableTypes

* chore: list fields test

* refactor: interface avalableTypes

* chore: uiSchema response in field source

* fix: view query

* chore: collection snippet

* refactor: view collection support preview

* fix: handle field source

* fix: typo

* fix: configure fileds title

* fix: configure fileds title

* fix: configure fileds title

* fix: sync from databse interface

* fix: sync from databse interface

* feat: set fields api

* fix: sync from databse fix

* feat: possibleTypes

* chore: fields get

* fix: sync from databse

* fix: list view test

* fix: view test in difference schema

* chore: comment

* feat: when there is only one source  collection, the view is a subset of a Collection

* feat: view collection add field

* fix: inherit query with schema

* fix: test

* fix: ci test

* fix: test with schema

* chore: set pg default search path

* chore: mysql test

* fix: test with schema

* chore: test

* chore: action test

* chore: view column usage return type

* feat: mysql field inference

* fix: tableName

* chore: node sql parser

* fix: sql build

* fix: database build

* fix: mysql test

* feat: view collection uiSchema title

* fix: incorrect field source display  when switching views

* refactor: view collection not allow modify

* fix: view collection is allow add, delete, and modify

* fix: mysql test

* fix: sqlite test

* fix: sqlite test

* fix: sqlite test

* fix: sqlite test

* chore: add id field as default target key

* style: style improve

* feat: load source field options

* style: style improve

* chore: disable remove column in view collection

* chore: support creating view collection with different schemas with the same name

* chore: support creating view collection with different schemas with the same name

* fix: query view in difference schema

* refactor: view collection viewname

* fix: query view collection in difference schema

* fix: field load

* chore: field options

* fix: mysql test

* fix: uiSchema component error when using a view field in a block

* fix: sqlite test

* chore: test

* fix: dump user views

* fix: view collection can be updated and edited in table block

* chore: sync from database display last field configuration

* chore: loadCollections

* chore: sync from database display last field configuration

* fix: field options merge issues

* style: preview table

* fix: view collection is allow using in kanban blocks

* refactor: code improve

* fix: view collection can be updated an edited in calendar block

* chore: disable infer field without interface

* feat: preview only shows source or interface fields

* fix: test

* refactor: locale

* feat: sql parser

* chore: remove node-sql-parser

* fix: yarn.lock

* test: view repository

* fix: view repository test

* chore: console.log

* chore: console.log

* fix: mysql without schema

* fix: mysql without schema

* chore: preview with field schema

* chore: tableActionInitializers

* style: preview style improve

* chore:  parameter is filter when there is no filterByTk

* fix: preview pagination

* fix: preview pagination

* style: preview table style improve

* fix: sync from database loading

* chore: preview performance optimization

* chore: preview performance optimization

* feat: limit & offset

* chore: preview performance optimization

* test: field with dot column

* fix: datetime interface display

* fix: missing boolean type

* fix: sync

* fix: sync from database

* style: style improve

* style: style improve

* style: style improve

* chore: preview table

* chore: preview table

* chore: preview table

* fix: styling

---------

Co-authored-by: katherinehhh <katherine_15995@163.com>
Co-authored-by: chenos <chenlinxh@gmail.com>
2023-04-01 21:56:01 +08:00
..
src feat: database view collection (#1587) 2023-04-01 21:56:01 +08:00
client.d.ts
client.js
LICENSE
package.json feat: multiple apps (#1540) 2023-03-10 19:16:00 +08:00
README.md docs: add plug-in documentation 2023-02-11 00:09:39 +08:00
README.zh-CN.md docs: add plug-in documentation 2023-02-11 00:09:39 +08:00
server.d.ts
server.js

Duplicator

English | 中文

NocoBase 应用的备份与还原插件,可用于应用的复制、迁移、升级等场景。

安装激活

内置插件无需手动安装激活。

使用方法

Duplicator 插件提供了 dumprestore 命令,分别用于备份和还原应用数据,可用于单应用的备份和还原,也可以跨应用。如果跨应用还原数据,请保证目标应用 NocoBase 版本与源应用一致,相对应插件也已下载本地。

⚠️ 如果使用了继承PostgreSQL、视图、触发器等不兼容的特性跨数据库还原备份数据可能失败。

备份数据

yarn nocobase dump

选择需要备份的插件表结构及其数据

? Select the plugin collections to be dumped (Press <space> to select, <a> to toggle all, <i> to invert selection, and <enter> to proceed)
 == Required ==
 - migration (core) (Disabled)
 - collections (collection-manager) (Disabled)
 - uiSchemas (ui-schema-storage) (Disabled)
 - uiRoutes (ui-routes-storage) (Disabled)
 - acl (acl) (Disabled)
 - workflowConfig (workflow) (Disabled)
 - snapshot-field (snapshot-field) (Disabled)
 - sequences (sequence-field) (Disabled)
 == Optional ==
❯◉ executionLogs (workflow)
 ◉ users (users)
 ◉ storageSetting (file-manager)
 ◉ attachmentRecords (file-manager)
 ◉ systemSettings (system-settings)
 ◉ verificationProviders (verification)
 ◉ verificationData (verification)
 ◉ oidcProviders (oidc)
 ◉ samlProviders (saml)
 ◉ mapConfiguration (map)
(Move up and down to reveal more choices)

选择需要备份的其他数据表的记录

? Select the collection records to be dumped (Press <space> to select, <a> to toggle all, <i> to invert selection, and <enter> to proceed)
❯◉ Test1
❯◉ Test2
❯◉ Test3

数据备份成功之后,备份文件位于 storage/duplicator 目录下:

dumped to /your/apps/a/storage/duplicator/dump-20230210T223910.nbdump
dumped file size: 20.8 kB

还原数据

yarn nocobase restore /your/apps/a/storage/duplicator/dump-20230210T223910.nbdump

导入前请先备份数据

? Danger !!! This action will overwrite your current data, please make sure you have a backup❗ (y/N)

选择需要还原的插件表结构及其数据

? Select the plugin collections to be restored (Press <space> to select, <a> to toggle all, <i> to invert selection, and <enter> to proceed)
 == Required ==
 - migration (core) (Disabled)
 - collections (collection-manager) (Disabled)
 - uiSchemas (ui-schema-storage) (Disabled)
 - uiRoutes (ui-routes-storage) (Disabled)
 - acl (acl) (Disabled)
 - workflowConfig (workflow) (Disabled)
 - sequences (sequence-field) (Disabled)
 == Optional ==
❯◯ executionLogs (workflow)
 ◯ users (users)
 ◯ storageSetting (file-manager)
 ◯ attachmentRecords (file-manager)
 ◯ systemSettings (system-settings)
 ◯ verificationProviders (verification)
 ◯ verificationData (verification)
 ◯ auditLogs (audit-logs)
 ◯ iframe html storage (iframe-block)

选择需要还原的其他数据表的记录

? Select the collection records to be restored (Press <space> to select, <a> to toggle all, <i> to invert selection, and <enter> to proceed)
❯◉ Test1
❯◉ Test2
❯◉ Test3

成功之后,重启应用

# for development
yarn dev
# for production
yarn start