refs #4823 Removed prefix for table names
This commit is contained in:
parent
355912fc57
commit
bfe36b1284
|
@ -67,7 +67,7 @@ SYNC_TRADEITEM = true
|
|||
### Foo.js
|
||||
|
||||
```javascript
|
||||
import { Sequelize } from "sequelize";
|
||||
import { Sequelize } from 'sequelize';
|
||||
|
||||
const bar = {
|
||||
barCharacteristicOne: {
|
||||
|
@ -83,7 +83,7 @@ const bar = {
|
|||
|
||||
export default (sequelize) => {
|
||||
const Foo = sequelize.define(
|
||||
"FDfoo",
|
||||
"foo",
|
||||
bar,
|
||||
{
|
||||
timestamps: false,
|
||||
|
|
|
@ -25,7 +25,7 @@ const clientConfig = {
|
|||
|
||||
export default (sequelize) => {
|
||||
const ClientConfig = sequelize.define(
|
||||
'FDClientConfig',
|
||||
'clientConfig',
|
||||
clientConfig,
|
||||
{
|
||||
timestamps: false,
|
||||
|
|
|
@ -23,7 +23,7 @@ const sequenceNumber = {
|
|||
|
||||
export default (sequelize) => {
|
||||
const sequenceNumbers = sequelize.define(
|
||||
'FDsequenceNumber',
|
||||
'sequenceNumber',
|
||||
sequenceNumber,
|
||||
{
|
||||
timestamps: false,
|
||||
|
|
|
@ -14,7 +14,7 @@ const connections = {
|
|||
|
||||
export default (sequelize) => {
|
||||
const connection = sequelize.define(
|
||||
'FDconnections',
|
||||
'connections',
|
||||
connections,
|
||||
{
|
||||
timestamps: false,
|
||||
|
|
|
@ -4,6 +4,12 @@ const suppliers = {
|
|||
sequenceNumber: {
|
||||
type: Sequelize.INTEGER,
|
||||
allowNull: false,
|
||||
primaryKey: true,
|
||||
},
|
||||
organizationId: {
|
||||
type: Sequelize.STRING,
|
||||
allowNull: false,
|
||||
primaryKey: true,
|
||||
},
|
||||
companyGln: {
|
||||
type: Sequelize.STRING,
|
||||
|
@ -13,7 +19,6 @@ const suppliers = {
|
|||
},
|
||||
commercialName: {
|
||||
type: Sequelize.STRING,
|
||||
allowNull: false,
|
||||
},
|
||||
email: {
|
||||
type: Sequelize.STRING,
|
||||
|
@ -24,10 +29,6 @@ const suppliers = {
|
|||
website: {
|
||||
type: Sequelize.STRING,
|
||||
},
|
||||
organizationId: {
|
||||
type: Sequelize.STRING,
|
||||
primaryKey: true,
|
||||
},
|
||||
rfhRelationId: {
|
||||
type: Sequelize.INTEGER,
|
||||
},
|
||||
|
@ -50,7 +51,7 @@ const suppliers = {
|
|||
};
|
||||
|
||||
export default (sequelize) => {
|
||||
const Suppliers = sequelize.define('FDsuppliers', suppliers, {
|
||||
const Suppliers = sequelize.define('suppliers', suppliers, {
|
||||
timestamps: false,
|
||||
freezeTableName: true,
|
||||
});
|
||||
|
|
|
@ -55,7 +55,7 @@ const supplyLine = {
|
|||
|
||||
|
||||
export default (sequelize) => {
|
||||
const SupplyLine = sequelize.define('FDsupplyLine', supplyLine, {
|
||||
const SupplyLine = sequelize.define('supplyLine', supplyLine, {
|
||||
timestamps: false,
|
||||
freezeTableName: true,
|
||||
});
|
||||
|
|
|
@ -15,7 +15,7 @@ const volumePrices = {
|
|||
};
|
||||
|
||||
export default (sequelize) => {
|
||||
const VolumePrices = sequelize.define('FDvolumePrices', volumePrices, {
|
||||
const VolumePrices = sequelize.define('volumePrices', volumePrices, {
|
||||
timestamps: false,
|
||||
freezeTableName: true,
|
||||
});
|
||||
|
|
|
@ -7,7 +7,7 @@ const botanicalNames = {
|
|||
};
|
||||
|
||||
export default (sequelize) => {
|
||||
const BotanicalNames = sequelize.define('FDbotanicalNames', botanicalNames, {
|
||||
const BotanicalNames = sequelize.define('botanicalNames', botanicalNames, {
|
||||
timestamps: false,
|
||||
freezeTableName: true,
|
||||
});
|
||||
|
|
|
@ -11,7 +11,7 @@ const characteristics = {
|
|||
|
||||
export default (sequelize) => {
|
||||
const Characteristics = sequelize.define(
|
||||
'FDcharacteristics',
|
||||
'characteristics',
|
||||
characteristics,
|
||||
{
|
||||
timestamps: false,
|
||||
|
|
|
@ -8,7 +8,7 @@ const countryOfOriginIsoCodes = {
|
|||
|
||||
export default (sequelize) => {
|
||||
const CountryOfOriginIsoCodes = sequelize.define(
|
||||
'FDcountryOfOriginIsoCodes',
|
||||
'countryOfOriginIsoCodes',
|
||||
countryOfOriginIsoCodes,
|
||||
{
|
||||
timestamps: false,
|
||||
|
|
|
@ -10,7 +10,7 @@ const PackageModel = {
|
|||
};
|
||||
|
||||
export default (sequelize) => {
|
||||
const Package = sequelize.define('FDpackage', PackageModel, {
|
||||
const Package = sequelize.define('package', PackageModel, {
|
||||
timestamps: false,
|
||||
freezeTableName: true,
|
||||
});
|
||||
|
|
|
@ -36,7 +36,7 @@ const packingConfigurations = {
|
|||
|
||||
export default (sequelize) => {
|
||||
const PackingConfigurations = sequelize.define(
|
||||
'FDpackingConfigurations',
|
||||
'packingConfig',
|
||||
packingConfigurations,
|
||||
{
|
||||
timestamps: false,
|
||||
|
|
|
@ -17,7 +17,7 @@ const photos = {
|
|||
};
|
||||
|
||||
export default (sequelize) => {
|
||||
const Photos = sequelize.define('FDphotos', photos, {
|
||||
const Photos = sequelize.define('photos', photos, {
|
||||
timestamps: false,
|
||||
freezeTableName: true,
|
||||
});
|
||||
|
|
|
@ -15,7 +15,7 @@ const seasonalPeriod = {
|
|||
};
|
||||
|
||||
export default (sequelize) => {
|
||||
const SeasonalPeriod = sequelize.define('FDseasonalPeriod', seasonalPeriod, {
|
||||
const SeasonalPeriod = sequelize.define('seasonalPeriod', seasonalPeriod, {
|
||||
timestamps: false,
|
||||
freezeTableName: true,
|
||||
});
|
||||
|
|
|
@ -38,7 +38,7 @@ const tradeItem = {
|
|||
};
|
||||
|
||||
export default (sequelize) => {
|
||||
const TradeItem = sequelize.define('FDtradeItem', tradeItem, {
|
||||
const TradeItem = sequelize.define('tradeItem', tradeItem, {
|
||||
timestamps: false,
|
||||
freezeTableName: true,
|
||||
});
|
||||
|
|
23
utils.js
23
utils.js
|
@ -273,17 +273,17 @@ export async function syncSuppliers(){
|
|||
await models.supplier.upsert({
|
||||
sequenceNumber: supplier.sequenceNumber,
|
||||
companyGln: supplier.companyGln,
|
||||
name: supplier.name,
|
||||
commercialName: supplier.commercialName,
|
||||
email: supplier.email,
|
||||
phone: supplier.phone,
|
||||
website: supplier.website,
|
||||
organizationId: supplier.organizationId,
|
||||
rfhRelationId: supplier.rfhRelationId,
|
||||
paymentProviders: `${supplier.paymentProviders}`,
|
||||
endDate: supplier.endDate,
|
||||
mailingAddress: supplier.mailingAddress,
|
||||
physicalAddress: supplier.physicalAddress,
|
||||
name: supplier.name ? supplier.name : null,
|
||||
commercialName: supplier.commercialName ? supplier.commercialName : null,
|
||||
email: supplier.email ? supplier.email : null,
|
||||
phone: supplier.phone ? supplier.phone : null,
|
||||
website: supplier.website ? supplier.website : null,
|
||||
organizationId: supplier.organizationId ? supplier.organizationId : null,
|
||||
rfhRelationId: supplier.rfhRelationId ? supplier.rfhRelationId : null,
|
||||
paymentProviders: supplier.paymentProviders.length ? `${supplier.paymentProviders}` : null,
|
||||
endDate: supplier.endDate ? supplier.endDate : null,
|
||||
mailingAddress: supplier.mailingAddress ? supplier.mailingAddress : null,
|
||||
physicalAddress: supplier.physicalAddress ? supplier.physicalAddress : null,
|
||||
});
|
||||
};
|
||||
await syncSequence(curSequenceNumber, 'suppliers', maxSequenceNumber);
|
||||
|
@ -616,7 +616,6 @@ export async function insertItem(tradeItem, supplier) {
|
|||
},
|
||||
{transaction: tx});
|
||||
|
||||
|
||||
let characteristics = tradeItem.characteristics;
|
||||
|
||||
for (let characteristic of characteristics) {
|
||||
|
|
Loading…
Reference in New Issue