sequelize-fixtures icon indicating copy to clipboard operation
sequelize-fixtures copied to clipboard

attribute "factory' not defined on model 'Foo'. warning, despite transformFixtureDataFn

Open skinofstars opened this issue 8 years ago • 1 comments

Hey, non breaking bug here.

I'm using a dummy data value so I can know when to load in a default model. However, even if I delete the key, it's still returning the error:

attribute "factory' not defined on model 'Foo'. warning, despite using transformFixtureDataFn to remove it.

i.e.

fixtures:
  - model: Foo
    data:
      factory: foo
transformFixtureDataFn: function (data) {
  if (data.factory) {
    data = require(`${ data.factory }.js`))(data);
    delete(data.factory);
  }
  return data;
}

So, like, I don't really think it should even care about extra values.

Otherwise, it's non-breaking, but it's just a bit annoying.

Also, there's a quote '"+'" type mismatch in this console: https://github.com/domasx2/sequelize-fixtures/blob/b6dd2200d4e7fdaff0e45c6277d9ed6d92bc7c04/lib/loader.js#L224

Thanks

skinofstars avatar Feb 14 '17 23:02 skinofstars

@skinofstars you can define any custom metadata you like under any property except data, such as:

- model: User
  # this works OK
  factory: foo 
  # so does this
  meta:
    foo: bar
  data:
    email: [email protected]

Does this help?

matmar10 avatar Apr 22 '19 14:04 matmar10