Ticket #222 (assigned enhancement)

Opened 5 years ago

Last modified 3 months ago

When running forwards and backwards migrations, raise an exception if someone uses a non-FakeORM model

Reported by: sfllaw@… Owned by: andrew
Priority: major Milestone: 1.0
Component: migrations Version: 0.6-pre
Keywords: Cc:

Description

Sometimes, people may import a Model directly in a forwards() or backwards() migration.

This is a bad idea, because it works around the ORM. We can warn against this if we monkey-patch every models.get_models() so that __getattribute__() raises a NativeModelError.

This can be caught by run_forwards() and run_backwards() to let the developer know which migration was at fault.

Change History

comment:1 Changed 5 years ago by andrew

  • Status changed from new to assigned
  • Version set to Mercurial tip
  • Milestone set to 0.6

Ah, interesting - I never considered MPing that one, only fiddling with the Migration's namespace.

comment:2 Changed 5 years ago by andrew

  • Milestone changed from 0.6 to 0.7

Punting back to 0.7

comment:3 Changed 5 years ago by andrew

  • Milestone changed from 0.7 to 0.7.1

comment:4 Changed 4 years ago by andrew

  • Milestone changed from 0.7.1 to 0.7.2

comment:5 Changed 4 years ago by andrew

  • Milestone changed from 0.7.2 to 1.0
Note: See TracTickets for help on using tickets.