@ghom/orm 1.9.0 → 1.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/app/table.js CHANGED
@@ -109,14 +109,14 @@ export class Table {
109
109
  version: -Infinity,
110
110
  };
111
111
  const baseVersion = data.version;
112
- await this.db.schema.alterTable(this.options.name, (builder) => {
113
- migrations.forEach((migration, version) => {
112
+ for (const [version, migration] of migrations) {
113
+ await this.db.schema.alterTable(this.options.name, (builder) => {
114
114
  if (version <= data.version)
115
115
  return;
116
116
  migration(builder);
117
117
  data.version = version;
118
118
  });
119
- });
119
+ }
120
120
  await this.db("migration")
121
121
  .insert(data)
122
122
  .onConflict("table")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ghom/orm",
3
- "version": "1.9.0",
3
+ "version": "1.9.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/tests/tables/b.js CHANGED
@@ -6,7 +6,9 @@ import { Table } from "../.."
6
6
  export default new Table({
7
7
  name: "b",
8
8
  migrations: {
9
- 0: (table) =>
9
+ 0: (table) => table.string("c_id"),
10
+ 1: (table) => table.dropColumn("c_id"),
11
+ 2: (table) =>
10
12
  table
11
13
  .integer("c_id")
12
14
  .unsigned()