@rwillians/qx 0.1.15 → 0.1.16
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.
|
@@ -15,11 +15,11 @@ const migrations = (0, index_1.table)('schema_migrations', t => ({
|
|
|
15
15
|
const defineMigrations = (migs) => async (db) => {
|
|
16
16
|
await index_1.create.table(migrations, { ifNotExists: true }).onto(db);
|
|
17
17
|
const { mostRecentId } = await (0, index_1.from)(migrations.as('m'))
|
|
18
|
-
.orderBy(({ m }) => [
|
|
18
|
+
.orderBy(({ m }) => [index_1.expr.desc(m.timestamp)])
|
|
19
19
|
.select(({ m }) => ({ mostRecentId: m.id }))
|
|
20
20
|
.one(db) || { mostRecentId: '' };
|
|
21
21
|
for (const [id, migrate] of Object.entries(migs)) {
|
|
22
|
-
if (id
|
|
22
|
+
if (id <= mostRecentId)
|
|
23
23
|
continue;
|
|
24
24
|
await (0, index_1.transaction)(db, async () => {
|
|
25
25
|
await migrate(db);
|
|
@@ -12,11 +12,11 @@ const migrations = table('schema_migrations', t => ({
|
|
|
12
12
|
export const defineMigrations = (migs) => async (db) => {
|
|
13
13
|
await create.table(migrations, { ifNotExists: true }).onto(db);
|
|
14
14
|
const { mostRecentId } = await from(migrations.as('m'))
|
|
15
|
-
.orderBy(({ m }) => [
|
|
15
|
+
.orderBy(({ m }) => [expr.desc(m.timestamp)])
|
|
16
16
|
.select(({ m }) => ({ mostRecentId: m.id }))
|
|
17
17
|
.one(db) || { mostRecentId: '' };
|
|
18
18
|
for (const [id, migrate] of Object.entries(migs)) {
|
|
19
|
-
if (id
|
|
19
|
+
if (id <= mostRecentId)
|
|
20
20
|
continue;
|
|
21
21
|
await transaction(db, async () => {
|
|
22
22
|
await migrate(db);
|