Releases: mbroersen/jeloquent
Releases · mbroersen/jeloquent
Adds original values
User.insert({id: 1, name: 'Hello Mister'});
const user = User.find(1);
user.name = 'Hello Mister 1';
user.name = 'Hello Mister 2';
user.originalValues
// returns
{id: 1, name: 'Hello Mister'}
Adds delete statement to model instance
Refactors index management
Adds delete statement
User.delete(1);
User.find(1).delete();
Fixes hasMany relations with a temporary key
Merge pull request #46 from mbroersen/develop Release 2.8.2
Use sets for the index relation lists
Merge pull request #45 from mbroersen/develop Release 2.8.1
Use maps for indexes
Merge pull request #44 from mbroersen/develop Release 2.8.0
use globalThis
Adds Webpack5
Fixes nullable polymorphic relations
Merge pull request #39 from mbroersen/develop fix nullable polymorphic relations
Fixes isDirty when previous value is null and new value is not
Merge pull request #38 from mbroersen/develop fixes isDirty on null values
Add renaming of belongsTo relation
- Add renaming of belongsTo relation
export default class TwoPersonTeam extends Model{
constructor() {
const fields = [
new Field('id', true),
new BelongsTo(User, 'user_one_id', 'user_one'),
new BelongsTo(User, 'user_two_id', 'user_two'),
]
super(fields);
}
}
TwoPersonTeam.insert({id: 1, user_one_id: 20, user_two_id});
TwoPersonTeam.find(1).user_one // returns User 20
TwoPersonTeam.find(1).user_two // returns User 50
- Adds inserting of morphTo field through model
Avatar.insert({
my_parent: [
{avatar_id: 9190, avatar_type: 'Team', name: 'AvatarInsertedTeam'},
{avatar_id: 2901, avatar_type: 'User', name: 'AvatarInsertedUser', team_id: 9190},
]
});
Updates foreign_key indexes on save
- Adds is dirty
User.find(1);
User.name = 'new name';
User.isDirty() // returns true;
User.isDirty('name') // returns true;