about summary refs log tree commit diff
path: root/db/migrate
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20200630190240_create_webauthn_credentials.rb16
-rw-r--r--db/migrate/20200630190544_add_webauthn_id_to_users.rb5
2 files changed, 21 insertions, 0 deletions
diff --git a/db/migrate/20200630190240_create_webauthn_credentials.rb b/db/migrate/20200630190240_create_webauthn_credentials.rb
new file mode 100644
index 000000000..ea924238d
--- /dev/null
+++ b/db/migrate/20200630190240_create_webauthn_credentials.rb
@@ -0,0 +1,16 @@
+class CreateWebauthnCredentials < ActiveRecord::Migration[5.2]
+  def change
+    create_table :webauthn_credentials do |t|
+      t.string :external_id, null: false
+      t.string :public_key, null: false
+      t.string :nickname, null: false
+      t.bigint :sign_count, null: false, default: 0
+
+      t.index :external_id, unique: true
+
+      t.references :user, foreign_key: true
+
+      t.timestamps
+    end
+  end
+end
diff --git a/db/migrate/20200630190544_add_webauthn_id_to_users.rb b/db/migrate/20200630190544_add_webauthn_id_to_users.rb
new file mode 100644
index 000000000..95d3c92a8
--- /dev/null
+++ b/db/migrate/20200630190544_add_webauthn_id_to_users.rb
@@ -0,0 +1,5 @@
+class AddWebauthnIdToUsers < ActiveRecord::Migration[5.2]
+  def change
+    add_column :users, :webauthn_id, :string
+  end
+end