mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
* ✨ change FE to handle new object type * 🚸 improve UX of handling invalid credentials * 🚧 WIP * 🎨 fix typescript issues * 🐘 add migrations for all supported dbs * ✏️ add description to migrations * ⚡ add credential update on import * ⚡ resolve after merge issues * 👕 fix lint issues * ⚡ check credentials on workflow create/update * update interface * 👕 fix ts issues * ⚡ adaption to new credentials UI * 🐛 intialize cache on BE for credentials check * 🐛 fix undefined oldCredentials * 🐛 fix deleting credential * 🐛 fix check for undefined keys * 🐛 fix disabling edit in execution * 🎨 just show credential name on execution view * ✏️ remove TODO * ⚡ implement review suggestions * ⚡ add cache to getCredentialsByType * ⏪ use getter instead of cache * ✏️ fix variable name typo * 🐘 include waiting nodes to migrations * 🐛 fix reverting migrations command * ⚡ update typeorm command * ✨ create db:revert command * 👕 fix lint error Co-authored-by: Mutasem <mutdmour@gmail.com>
63 lines
1.4 KiB
TypeScript
63 lines
1.4 KiB
TypeScript
/* eslint-disable import/no-cycle */
|
|
import { WorkflowExecuteMode } from 'n8n-workflow';
|
|
|
|
import { Column, ColumnOptions, Entity, Index, PrimaryGeneratedColumn } from 'typeorm';
|
|
import config = require('../../../config');
|
|
import { DatabaseType, IExecutionFlattedDb, IWorkflowDb } from '../..';
|
|
|
|
function resolveDataType(dataType: string) {
|
|
const dbType = config.get('database.type') as DatabaseType;
|
|
|
|
const typeMap: { [key in DatabaseType]: { [key: string]: string } } = {
|
|
sqlite: {
|
|
json: 'simple-json',
|
|
},
|
|
postgresdb: {
|
|
datetime: 'timestamptz',
|
|
},
|
|
mysqldb: {},
|
|
mariadb: {},
|
|
};
|
|
|
|
return typeMap[dbType][dataType] ?? dataType;
|
|
}
|
|
|
|
@Entity()
|
|
export class ExecutionEntity implements IExecutionFlattedDb {
|
|
@PrimaryGeneratedColumn()
|
|
id: number;
|
|
|
|
@Column('text')
|
|
data: string;
|
|
|
|
@Column()
|
|
finished: boolean;
|
|
|
|
@Column('varchar')
|
|
mode: WorkflowExecuteMode;
|
|
|
|
@Column({ nullable: true })
|
|
retryOf: string;
|
|
|
|
@Column({ nullable: true })
|
|
retrySuccessId: string;
|
|
|
|
@Column(resolveDataType('datetime'))
|
|
startedAt: Date;
|
|
|
|
@Index()
|
|
@Column({ type: resolveDataType('datetime') as ColumnOptions['type'], nullable: true })
|
|
stoppedAt: Date;
|
|
|
|
@Column(resolveDataType('json'))
|
|
workflowData: IWorkflowDb;
|
|
|
|
@Index()
|
|
@Column({ nullable: true })
|
|
workflowId: string;
|
|
|
|
@Index()
|
|
@Column({ type: resolveDataType('datetime') as ColumnOptions['type'], nullable: true })
|
|
waitTill: Date;
|
|
}
|