Skip to content

Commit

Permalink
feat: added utils schema
Browse files Browse the repository at this point in the history
  • Loading branch information
wajeht committed Jul 20, 2022
1 parent 020e133 commit 7fa178a
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/database/migrations/20220720093348_utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* @param { import("knex").Knex } knex
* @returns { Promise<void> }
*/
export async function up(knex) {
// utils
await knex.schema.raw(`
CREATE TABLE IF NOT EXISTS utils (
id SERIAL PRIMARY KEY,
object VARCHAR(250),
description VARCHAR(1000),
json jsonb,
user_id INT REFERENCES users on DELETE CASCADE,
deleted BOOLEAN DEFAULT FALSE,
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
updated_at TIMESTAMP NOT NULL DEFAULT NOW()
);
`);
}

/**
* @param { import("knex").Knex } knex
* @returns { Promise<void> }
*/
export async function down(knex) {
await knex.schema.raw(`DROP TABLE IF EXISTS utils;`);
}

0 comments on commit 7fa178a

Please sign in to comment.