Skip to content

Commit

Permalink
refactor: consistent naming
Browse files Browse the repository at this point in the history
  • Loading branch information
RihanArfan committed Oct 24, 2024
1 parent 9d62b1a commit deec85c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/runtime/database/server/utils/migrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ export const applyMigrations = async () => {

await db.prepare(createMigrationsTableQuery).run() // create migrations table

const remoteMigrations = (await db.prepare(appliedMigrationsQuery).all()).results
if (!remoteMigrations.length) log.warn(`No applied migrations on \`dev\``)
const appliedMigrations = (await db.prepare(appliedMigrationsQuery).all()).results
if (!appliedMigrations.length) log.warn(`No applied migrations on \`dev\``)

const localMigrations = (await getMigrationFiles()).map(fileName => fileName.replace('.sql', ''))
const pendingMigrations = localMigrations.filter(localName => !remoteMigrations.find(({ name }) => name === localName))
const pendingMigrations = localMigrations.filter(localName => !appliedMigrations.find(({ name }) => name === localName))
if (!pendingMigrations.length) return log.info('No pending migrations to apply')

for (const migration of pendingMigrations) {
Expand Down

0 comments on commit deec85c

Please sign in to comment.