mirror of
https://gitee.com/nocobase/nocobase.git
synced 2024-12-02 04:07:50 +08:00
fix(collection-manager): update timestamps to true
This commit is contained in:
parent
d7ec5d547e
commit
1868a8a5f3
@ -143,7 +143,7 @@ export function afterCreateForForeignKeyField(db: Database) {
|
||||
values: {
|
||||
name: through,
|
||||
title: through,
|
||||
timestamps: false,
|
||||
timestamps: true,
|
||||
autoGenId: false,
|
||||
hidden: true,
|
||||
autoCreate: true,
|
||||
|
@ -0,0 +1,23 @@
|
||||
import { Migration } from '@nocobase/server';
|
||||
|
||||
export default class extends Migration {
|
||||
async up() {
|
||||
const result = await this.app.version.satisfies('<=0.8.0-alpha.13');
|
||||
if (!result) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const collections = await this.app.db.getRepository('collections').find();
|
||||
console.log('migrating...');
|
||||
for (const collection of collections) {
|
||||
if (collection.get('autoCreate') && collection.get('isThrough')) {
|
||||
collection.set('timestamps', true);
|
||||
await collection.save();
|
||||
console.log(`collection name: ${collection.name}`);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
import Topo from '@hapi/topo';
|
||||
import { Model, Repository } from '@nocobase/database';
|
||||
import { CollectionModel } from '../models/collection';
|
||||
import Topo from '@hapi/topo';
|
||||
|
||||
interface LoadOptions {
|
||||
filter?: any;
|
||||
|
Loading…
Reference in New Issue
Block a user