mirror of
https://github.com/docusealco/docuseal
synced 2026-11-07 15:22:33 -05:00
populate linked accounts
This commit is contained in:
1 parent
bb613059de
commit
667d065bee
2 files changed
+29
-1
No files matched your search
@@ -0,0 +1,28 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class PopulateAccountLinkedAccounts < ActiveRecord::Migration[7.1]
|
||||||
|
class MigrationAccount < ApplicationRecord
|
||||||
|
self.table_name = 'accounts'
|
||||||
|
end
|
||||||
|
|
||||||
|
class MigrationAccountLinkedAccount < ApplicationRecord
|
||||||
|
self.table_name = 'account_linked_accounts'
|
||||||
|
end
|
||||||
|
|
||||||
|
def up
|
||||||
|
return if Docuseal.multitenant?
|
||||||
|
|
||||||
|
MigrationAccount.order(:id).each do |account|
|
||||||
|
next if account.id == 1
|
||||||
|
next if MigrationAccountLinkedAccount.exists?(linked_account_id: account.id)
|
||||||
|
|
||||||
|
MigrationAccountLinkedAccount.create!(account_id: 1,
|
||||||
|
linked_account_id: account.id,
|
||||||
|
account_type: :linked)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
end
|
||||||
+1
-1
@@ -10,7 +10,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema[7.1].define(version: 2024_04_28_072623) do
|
ActiveRecord::Schema[7.1].define(version: 2024_04_28_112400) do
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user