mirror of https://github.com/docusealco/docuseal
				
				
				
			
			You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							29 lines
						
					
					
						
							751 B
						
					
					
				
			
		
		
	
	
							29 lines
						
					
					
						
							751 B
						
					
					
				| # 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
 |