Delete all tables from a specific schema version #2861
-
Is there a way to delete all the tables from a specific schema version (not being the latest one) ?
where in version 57 all tables were deleted and re-created again, and now in the newest version 58 I would like to add a new column to a table. Using the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You have access to the schema at a specific version through the So you can use from56To57: (m, schema) async {
for (final table in schema.entities.whereType<TableInfo>()) {
await m.deleteTable(table.actualTableName);
await m.createTable(table);
}
await m.recreateAllViews();
}, |
Beta Was this translation helpful? Give feedback.
You have access to the schema at a specific version through the
schema
callback passed to these migrations.So you can use