You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
we could do a up / down system? to apply / migrate data depending of the stage?
// Or connector?awaitilorm.applyMigration()Schema.version(timestamporversion? orboth?,DEF).up((old,new)=>{}).down((old,new)=>{})
ex;
// Always most recent version;constuserSchema=newSchema({id: Schema.string(),firstName: Schema.string(),lastName: Schema.string(),age: Schema.number(),})// Declare old version of the schema;userSchema.version(3232323,{id: Schema.string(),name: Schema.string(),age: Schema.string(),}).up(UserModel=>{UserModel.query().stream().on('data',user=>{const[firstName,lastName]=user.name.split(' ');user.firstName=firstName;user.lastName=lastName;user.age=parseInt(user.previous.age)user.save();});}).down(UserModel=>{UserModel.query().stream().on('data',user=>{user.name=`${user.firstName}${user.lastName}`;user.age=`${user.previous.age}`user.save();});});
Keep in mind;
We probably want a way to up / down, and change multiple model at once.
We want to apply up and down for similar version schema on different model at the same time.
The way to proceed is probably;
for each schema version;
Create new column / alter old column (for keeping data)
Run up on every schema of the given version of the schema
Drop old column
The text was updated successfully, but these errors were encountered:
Make a system to manage migration?
we could do a up / down system? to apply / migrate data depending of the stage?
ex;
Keep in mind;
The way to proceed is probably;
for each schema version;
The text was updated successfully, but these errors were encountered: