new(kb.gblib): added postgres.
This commit is contained in:
parent
57b83aba2b
commit
745819b732
1 changed files with 9 additions and 6 deletions
|
@ -291,14 +291,17 @@ export class GBVMService extends GBService {
|
||||||
define: {
|
define: {
|
||||||
// Convert all table names to lowercase
|
// Convert all table names to lowercase
|
||||||
freezeTableName: true,
|
freezeTableName: true,
|
||||||
tableName: function() {
|
|
||||||
return this.name.toLowerCase();
|
|
||||||
},
|
|
||||||
hooks: {
|
hooks: {
|
||||||
beforeDefine: (attributes, options) => {
|
beforeDefine: (attributes, options) => {
|
||||||
// Convert model and column names to lowercase
|
// Convert model name and table name to lowercase
|
||||||
options.tableName = options.tableName?.toLowerCase();
|
if (options.modelName) {
|
||||||
for (const attr in attributes) {
|
options.modelName = options.modelName.toLowerCase();
|
||||||
|
}
|
||||||
|
if (options.tableName) {
|
||||||
|
options.tableName = options.tableName.toLowerCase();
|
||||||
|
} else {
|
||||||
|
options.tableName = options.modelName.toLowerCase();
|
||||||
|
} for (const attr in attributes) {
|
||||||
const lowered = attr.toLowerCase();
|
const lowered = attr.toLowerCase();
|
||||||
if (attr !== lowered) {
|
if (attr !== lowered) {
|
||||||
attributes[lowered] = attributes[attr];
|
attributes[lowered] = attributes[attr];
|
||||||
|
|
Loading…
Add table
Reference in a new issue