mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 21:49:25 +08:00
Merge remote-tracking branch 'origin/main' into next
This commit is contained in:
commit
548cfe3e56
@ -127,6 +127,8 @@ describe('view inference', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const createdAt = UserCollection.model.rawAttributes['createdAt'].field;
|
const createdAt = UserCollection.model.rawAttributes['createdAt'].field;
|
||||||
|
expect(inferredFields[createdAt]['field']).toBeDefined();
|
||||||
|
|
||||||
if (db.isMySQLCompatibleDialect()) {
|
if (db.isMySQLCompatibleDialect()) {
|
||||||
expect(inferredFields[createdAt]['type']).toBe('datetimeNoTz');
|
expect(inferredFields[createdAt]['type']).toBe('datetimeNoTz');
|
||||||
} else {
|
} else {
|
||||||
|
@ -52,7 +52,7 @@ export class ViewFieldInference {
|
|||||||
const rawFields = [];
|
const rawFields = [];
|
||||||
|
|
||||||
for (const [name, column] of Object.entries(columns)) {
|
for (const [name, column] of Object.entries(columns)) {
|
||||||
const inferResult: any = { name, rawType: column.type };
|
const inferResult: any = { name, rawType: column.type, field: name };
|
||||||
|
|
||||||
const usage = columnUsage[name];
|
const usage = columnUsage[name];
|
||||||
|
|
||||||
|
@ -450,7 +450,7 @@ describe('view collection', function () {
|
|||||||
|
|
||||||
const dropViewSQL = `DROP VIEW IF EXISTS test_view`;
|
const dropViewSQL = `DROP VIEW IF EXISTS test_view`;
|
||||||
await db.sequelize.query(dropViewSQL);
|
await db.sequelize.query(dropViewSQL);
|
||||||
const viewSQL = `CREATE VIEW test_view AS select 1+1 as "Uppercase"`;
|
const viewSQL = `CREATE VIEW test_view AS select 1+1 as "t_Uppercase"`;
|
||||||
await db.sequelize.query(viewSQL);
|
await db.sequelize.query(viewSQL);
|
||||||
|
|
||||||
await collectionRepository.create({
|
await collectionRepository.create({
|
||||||
@ -458,7 +458,7 @@ describe('view collection', function () {
|
|||||||
name: 'view_collection',
|
name: 'view_collection',
|
||||||
viewName: 'test_view',
|
viewName: 'test_view',
|
||||||
isView: true,
|
isView: true,
|
||||||
fields: [{ type: 'string', name: 'upper_case', field: 'Uppercase' }],
|
fields: [{ type: 'string', name: 'upper_case', field: 't_Uppercase' }],
|
||||||
schema: db.inDialect('postgres') ? 'public' : undefined,
|
schema: db.inDialect('postgres') ? 'public' : undefined,
|
||||||
},
|
},
|
||||||
context: {},
|
context: {},
|
||||||
@ -466,7 +466,7 @@ describe('view collection', function () {
|
|||||||
|
|
||||||
const viewCollection = db.getCollection('view_collection');
|
const viewCollection = db.getCollection('view_collection');
|
||||||
|
|
||||||
expect(viewCollection.model.rawAttributes['upper_case'].field).toEqual('Uppercase');
|
expect(viewCollection.model.rawAttributes['upper_case'].field).toEqual('t_Uppercase');
|
||||||
const results = await viewCollection.repository.find();
|
const results = await viewCollection.repository.find();
|
||||||
expect(results.length).toBe(1);
|
expect(results.length).toBe(1);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user