mirror of
https://github.com/whyour/qinglong.git
synced 2026-09-20 16:07:11 +08:00
feat(ql3): establish 3.0 incubation baseline
This commit is contained in:
@@ -11,6 +11,8 @@ export enum InstanceStatus {
|
||||
export interface RunningInstanceAttributes {
|
||||
id?: number;
|
||||
cron_id: number;
|
||||
run_id?: string | null;
|
||||
attempt_id?: string | null;
|
||||
pid?: number;
|
||||
log_path?: string;
|
||||
started_at: number;
|
||||
@@ -22,6 +24,8 @@ export interface RunningInstanceAttributes {
|
||||
export class RunningInstance {
|
||||
id?: number;
|
||||
cron_id!: number;
|
||||
run_id?: string | null;
|
||||
attempt_id?: string | null;
|
||||
pid?: number;
|
||||
log_path?: string;
|
||||
started_at!: number;
|
||||
@@ -32,6 +36,8 @@ export class RunningInstance {
|
||||
constructor(options: RunningInstanceAttributes) {
|
||||
this.id = options.id;
|
||||
this.cron_id = options.cron_id;
|
||||
this.run_id = options.run_id;
|
||||
this.attempt_id = options.attempt_id;
|
||||
this.pid = options.pid;
|
||||
this.log_path = options.log_path;
|
||||
this.started_at = options.started_at;
|
||||
@@ -52,6 +58,15 @@ export const RunningInstanceModel = sequelize.define<RunningInstanceModel>(
|
||||
type: DataTypes.NUMBER,
|
||||
allowNull: false,
|
||||
},
|
||||
run_id: {
|
||||
type: DataTypes.STRING(36),
|
||||
allowNull: true,
|
||||
},
|
||||
attempt_id: {
|
||||
type: DataTypes.STRING(36),
|
||||
allowNull: true,
|
||||
unique: 'running_instances_attempt_uidx',
|
||||
},
|
||||
pid: {
|
||||
type: DataTypes.NUMBER,
|
||||
allowNull: true,
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
import { DataTypes, Model, ModelStatic, Sequelize } from 'sequelize';
|
||||
import { sequelize } from '.';
|
||||
|
||||
export interface SchemaMigrationAttributes {
|
||||
id: string;
|
||||
checksum: string;
|
||||
applied_at: number;
|
||||
}
|
||||
|
||||
export interface SchemaMigrationInstance
|
||||
extends Model<SchemaMigrationAttributes, SchemaMigrationAttributes>,
|
||||
SchemaMigrationAttributes {}
|
||||
|
||||
export function defineSchemaMigrationModel(
|
||||
database: Sequelize,
|
||||
): ModelStatic<SchemaMigrationInstance> {
|
||||
return database.define<SchemaMigrationInstance>(
|
||||
'SchemaMigration',
|
||||
{
|
||||
id: {
|
||||
type: DataTypes.STRING,
|
||||
primaryKey: true,
|
||||
},
|
||||
checksum: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
},
|
||||
applied_at: {
|
||||
type: DataTypes.BIGINT,
|
||||
allowNull: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
tableName: 'SchemaMigrations',
|
||||
timestamps: false,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export const SchemaMigrationModel = defineSchemaMigrationModel(sequelize);
|
||||
Reference in New Issue
Block a user