Skip to content

Commit 56c01df

Browse files
committed
✨ Refactor users table migration: Update schema to include username, avatar, and social media IDs; enhance timestamps and default values for admin and sponsor roles.
1 parent 8950969 commit 56c01df

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

database/migrations/1736839410875_create_users_table.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,23 @@ export default class extends BaseSchema {
55

66
async up() {
77
this.schema.createTable(this.tableName, (table) => {
8-
table.increments('id').notNullable()
9-
table.string('full_name').nullable()
10-
table.string('email', 254).notNullable().unique()
8+
table.increments('id').primary()
9+
table.string('username').unique().notNullable()
10+
table.string('name').nullable()
11+
table.string('email').unique().notNullable()
1112
table.string('password').notNullable()
12-
13-
table.timestamp('created_at').notNullable()
14-
table.timestamp('updated_at').nullable()
13+
table.string('avatar').nullable()
14+
table.string('github_id').unique().nullable()
15+
table.string('twitter_id').unique().nullable()
16+
table.boolean('is_admin').defaultTo(false)
17+
table.boolean('is_sponsor').defaultTo(false)
18+
table.timestamp('email_verified_at').nullable()
19+
table.string('remember_me_token').nullable()
20+
table.timestamps(true, true)
1521
})
1622
}
1723

1824
async down() {
1925
this.schema.dropTable(this.tableName)
2026
}
21-
}
27+
}

0 commit comments

Comments
 (0)