Initial commit
This commit is contained in:
25
migrations/20251123_create_push_subscriptions.js
Normal file
25
migrations/20251123_create_push_subscriptions.js
Normal file
@@ -0,0 +1,25 @@
|
||||
exports.up = function (knex) {
|
||||
return knex.schema.createTable('push_subscriptions', (t) => {
|
||||
t.uuid('id')
|
||||
.primary()
|
||||
.defaultTo(knex.raw('gen_random_uuid()'));
|
||||
|
||||
// ✅ users.id é integer no teu caso
|
||||
t.integer('user_id')
|
||||
.notNullable()
|
||||
.references('id')
|
||||
.inTable('users')
|
||||
.onDelete('CASCADE');
|
||||
|
||||
t.text('endpoint').notNullable().unique();
|
||||
t.text('p256dh').notNullable();
|
||||
t.text('auth').notNullable();
|
||||
t.text('user_agent');
|
||||
t.timestamp('created_at').defaultTo(knex.fn.now());
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function (knex) {
|
||||
return knex.schema.dropTableIfExists('push_subscriptions');
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user