Exactly right. This why, if I "must" use AR in a migration, I prefer to redefine (much simplified) classes within the migration file... ensuring that the AR class definitions match the db schema.
Also, for large datasets, executing SQL rather than instantiating AR records can mean your migration runs in seconds rather than minutes/hours.
Exactly right. This why, if I "must" use AR in a migration, I prefer to redefine (much simplified) classes within the migration file... ensuring that the AR class definitions match the db schema.
Also, for large datasets, executing SQL rather than instantiating AR records can mean your migration runs in seconds rather than minutes/hours.