Skip to content

Commit

Permalink
Added updated_at and updated_by columns for embeds (#172)
Browse files Browse the repository at this point in the history
* Added updated_at and updated_by columns for embeds
- Will be changed to NOT NULL in future updates (updated_by)

* Removed pre-set for updated_by column. Will be set later with NOT NULL.
  • Loading branch information
TheXardas authored Aug 22, 2024
1 parent 393615b commit 0f667d0
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/db/migrations/20240821135008_embeds_add_updated_by_columns.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import {Knex} from 'knex';

export async function up(knex: Knex): Promise<void> {
return knex.raw(`
ALTER TABLE embeds
ADD COLUMN updated_by TEXT,
ADD COLUMN updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW();
CREATE INDEX embeds_updated_at_idx ON embeds USING BTREE (updated_at);
`);
}

export async function down(knex: Knex): Promise<void> {
return knex.raw(`
ALTER TABLE embeds
DROP COLUMN updated_at,
DROP COLUMN updated_by;
`);
}

0 comments on commit 0f667d0

Please sign in to comment.