mirror of https://github.com/docusealco/docuseal
parent
bacbc4309c
commit
1746920eb5
@ -0,0 +1,26 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
# == Schema Information
|
||||||
|
#
|
||||||
|
# Table name: template_accesses
|
||||||
|
#
|
||||||
|
# id :bigint not null, primary key
|
||||||
|
# created_at :datetime not null
|
||||||
|
# updated_at :datetime not null
|
||||||
|
# template_id :bigint not null
|
||||||
|
# user_id :bigint not null
|
||||||
|
#
|
||||||
|
# Indexes
|
||||||
|
#
|
||||||
|
# index_template_accesses_on_template_id_and_user_id (template_id,user_id) UNIQUE
|
||||||
|
#
|
||||||
|
# Foreign Keys
|
||||||
|
#
|
||||||
|
# fk_rails_... (template_id => templates.id)
|
||||||
|
#
|
||||||
|
class TemplateAccess < ApplicationRecord
|
||||||
|
ADMIN_USER_ID = -1
|
||||||
|
|
||||||
|
belongs_to :template
|
||||||
|
belongs_to :user, optional: true
|
||||||
|
end
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class CreateTemplateAccesses < ActiveRecord::Migration[7.2]
|
||||||
|
def change
|
||||||
|
create_table :template_accesses do |t|
|
||||||
|
t.references :template, null: false, foreign_key: true, index: false
|
||||||
|
t.references :user, null: false, foreign_key: false, index: false
|
||||||
|
|
||||||
|
t.index %i[template_id user_id], unique: true
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
Loading…
Reference in new issue