Manually find the primary field by going through the schema fields.
()
| 176 | |
| 177 | /** Manually find the primary field by going through the schema fields. */ |
| 178 | private static _findPrimaryField(): FieldOptions { |
| 179 | const field = Object.entries(this.fields).find( |
| 180 | ([_, fieldType]) => typeof fieldType === "object" && fieldType.primaryKey, |
| 181 | ); |
| 182 | |
| 183 | return { |
| 184 | name: field ? (this.formatFieldToDatabase(field[0]) as string) : "", |
| 185 | type: field ? field[1] : DataTypes.INTEGER, |
| 186 | defaultValue: 0, |
| 187 | }; |
| 188 | } |
| 189 | |
| 190 | /** Manually find the primary key by going through the schema fields. */ |
| 191 | private static _findPrimaryKey(): string { |
no test coverage detected