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: {
|
values: {
|
||||||
name: through,
|
name: through,
|
||||||
title: through,
|
title: through,
|
||||||
timestamps: false,
|
timestamps: true,
|
||||||
autoGenId: false,
|
autoGenId: false,
|
||||||
hidden: true,
|
hidden: true,
|
||||||
autoCreate: 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 { Model, Repository } from '@nocobase/database';
|
||||||
import { CollectionModel } from '../models/collection';
|
import { CollectionModel } from '../models/collection';
|
||||||
import Topo from '@hapi/topo';
|
|
||||||
|
|
||||||
interface LoadOptions {
|
interface LoadOptions {
|
||||||
filter?: any;
|
filter?: any;
|
||||||
|
Loading…
Reference in New Issue
Block a user