Files
mv2_simple_crx/server/models/index.js
张成 5b671d320b 1
2026-03-18 14:18:41 +08:00

16 lines
748 B
JavaScript

import { Sequelize } from 'sequelize';
import { get_sequelize_options } from '../config/database.js';
import { define_crawl_run_record } from './crawl_run_record.js';
import { define_schedule_task } from './schedule_task.js';
const sequelize_options = get_sequelize_options();
const { database, username, password, ...rest } = sequelize_options;
export const sequelize = new Sequelize(database, username, password, rest);
export const crawl_run_record = define_crawl_run_record(sequelize);
export const schedule_task = define_schedule_task(sequelize);
schedule_task.hasMany(crawl_run_record, { foreignKey: 'schedule_task_id', as: 'records' });
crawl_run_record.belongsTo(schedule_task, { foreignKey: 'schedule_task_id', as: 'schedule_task' });