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'); };