diff --git a/src/db/migrations/000_initial.ts b/src/db/migrations/000_initial.ts
index 5bbbc8d..7b65a68 100644
--- a/src/db/migrations/000_initial.ts
+++ b/src/db/migrations/000_initial.ts
@@ -156,6 +156,12 @@ async function createUsersRolesTable(query: { context: any }) {
       defaultValue: () => new Date(),
     },
   });
+
+  // <userId, roleId> must be unique
+  await query.context.addConstraint($db.tableName('users_roles'), {
+    fields: ['userId', 'roleId'],
+    type: 'unique',
+  });
 }
 
 async function createUserSessionsTable(query: { context: any }) {
@@ -190,6 +196,12 @@ async function createUserSessionsTable(query: { context: any }) {
       defaultValue: () => new Date(),
     },
   });
+
+  // <userId, name> must be unique
+  await query.context.addConstraint($db.tableName('user_sessions'), {
+    fields: ['userId', 'name'],
+    type: 'unique',
+  });
 }
 
 async function createUserDevicesTable(query: { context: any }) {
@@ -219,6 +231,12 @@ async function createUserDevicesTable(query: { context: any }) {
       defaultValue: () => new Date(),
     },
   });
+
+  // <userId, name> must be unique
+  await query.context.addConstraint($db.tableName('user_devices'), {
+    fields: ['userId', 'name'],
+    type: 'unique',
+  });
 }
 
 async function up(query: { context: any }) {