mirror of https://github.com/docusealco/docuseal
parent
9da7463657
commit
11a90d797a
@ -0,0 +1,29 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: encrypted_user_configs
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# key :string not null
|
||||
# value :text not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# user_id :bigint not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_encrypted_user_configs_on_user_id (user_id)
|
||||
# index_encrypted_user_configs_on_user_id_and_key (user_id,key) UNIQUE
|
||||
#
|
||||
# Foreign Keys
|
||||
#
|
||||
# fk_rails_... (user_id => users.id)
|
||||
#
|
||||
class EncryptedUserConfig < ApplicationRecord
|
||||
belongs_to :user
|
||||
|
||||
encrypts :value
|
||||
|
||||
serialize :value, JSON
|
||||
end
|
||||
@ -0,0 +1,15 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class CreateEncryptedUserConfigs < ActiveRecord::Migration[7.0]
|
||||
def change
|
||||
create_table :encrypted_user_configs do |t|
|
||||
t.references :user, null: false, foreign_key: true, index: true
|
||||
t.string :key, null: false
|
||||
t.text :value, null: false
|
||||
|
||||
t.index %i[user_id key], unique: true
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Reference in new issue