-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#issue-27] add tenant column to plutus accounts table
- Loading branch information
Showing
4 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
fixture_rails_root/db/migrate/20141027103120_tenant_plutus_tables.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class TenantPlutusTables < ActiveRecord::Migration | ||
def change | ||
# add a tenant column to plutus accounts table. | ||
add_column :plutus_accounts, :tenant_id, :string, index: true | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class TenantPlutusTables < ActiveRecord::Migration | ||
def change | ||
# add a tenant column to plutus accounts table. | ||
add_column :plutus_accounts, :tenant_id, :string, index: true | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# lib/generators/plutus/plutus_generator.rb | ||
require 'rails/generators' | ||
require 'rails/generators/migration' | ||
|
||
module Plutus | ||
class TenancyGenerator < Rails::Generators::Base | ||
include Rails::Generators::Migration | ||
|
||
def self.source_root | ||
@source_root ||= File.join(File.dirname(__FILE__), 'templates') | ||
end | ||
|
||
# Implement the required interface for Rails::Generators::Migration. | ||
# taken from http://github.com/rails/rails/blob/master/activerecord/lib/generators/active_record.rb | ||
def self.next_migration_number(dirname) | ||
if ActiveRecord::Base.timestamped_migrations | ||
Time.now.utc.strftime("%Y%m%d%H%M%S") | ||
else | ||
"%.3d" % (current_migration_number(dirname) + 1) | ||
end | ||
end | ||
|
||
def create_migration_file | ||
migration_template 'tenant_migration.rb', 'db/migrate/tenant_plutus_tables.rb' | ||
end | ||
end | ||
end |