Skip to content

Commit

Permalink
feat(database): Update users table migration to include additional co…
Browse files Browse the repository at this point in the history
…lumns
  • Loading branch information
wajeht committed Aug 7, 2024
1 parent 702fdf8 commit 4ac9a6f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ services:
volumes:
- 'postgres-data:/var/lib/postgresql/data'
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U ${DB_USERNAME}']
test: ['CMD-SHELL', 'pg_isready -U ${DB_USERNAME} -d ${DB_DATABASE}']
interval: 30s
timeout: 10s
retries: 5
Expand Down
18 changes: 16 additions & 2 deletions src/database/migrations/20240807213915_create_users_table.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
import type { Knex } from 'knex';

export async function up(knex: Knex): Promise<void> {}
export async function up(knex: Knex): Promise<void> {
await knex.schema.createTable('users', (table) => {
table.increments('id').primary();
table.string('email').unique().notNullable();
table.string('password').notNullable();
table.boolean('is_verified').defaultTo(false);
table.string('verification_token').nullable();
table.timestamp('verification_token_expires_at').nullable();
table.string('reset_password_token').nullable();
table.timestamp('reset_password_token_expires_at').nullable();
table.timestamps(true, true);
});
}

export async function down(knex: Knex): Promise<void> {}
export async function down(knex: Knex): Promise<void> {
await knex.schema.dropTableIfExists('users');
}

0 comments on commit 4ac9a6f

Please sign in to comment.