Files
speckle-server/packages/server/modules/core/migrations
Kristaps Fabians Geikins 1d2a594f0a chore: upgrade TS 5.2 -> 5.7.3 & ESLint to 9.20.1 (#4032)
* chore: upgrade TS 5.2 -> 5.7.3

* vite dts fix

* lint fix

* resolutions fix

* ui comp build fix

* precommit fix?

* latest eslint version

* autoloader fix

* undo unnecessary viewer change

* eslint fixes fe2 + trying disabled type linting

* lint fixes
2025-02-20 14:18:18 +02:00
..

Migrations, and how to create them

First, make a new migration file in the appropriate migrations folder. To do this use ./bin/cli.

Next, write your migration! Here's an example below that adds a new column to a table.

/* istanbul ignore file */
exports.up = async (knex) => {
  await knex.schema.alterTable('scopes', (table) => {
    table.boolean('public').defaultTo(true)
  })
}

exports.down = async (knex) => {
  let hasColumn = await knex.schema.hasColumn('scopes', 'public')
  if (hasColumn) {
    await knex.schema.alterTable('scopes', (table) => {
      table.dropColumn('public')
    })
  }
}

Notes:

  • Do not delete or edit existing migration files
  • To edit an existing table, use alter table in a new migration file.
  • Always prefix your migration file with the date that you authored it in.