-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow support for tenant_ids that are strings and enable tenancy from…
… the get-go
- Loading branch information
1 parent
c1f28c0
commit 93ce285
Showing
10 changed files
with
117 additions
and
85 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,10 +1,15 @@ | ||
# Not Released | ||
## Fixed | ||
- Fix loading of jquery-ui files (Fixes https://github.com/mbulat/plutus/issues/58) | ||
|
||
## Added | ||
- Add `Account#amounts` and `Account#entries` to get all amounts and entries, respectively | ||
# Change Log | ||
All notable changes to this project will be documented in this file. | ||
This project adheres to [Semantic Versioning](http://semver.org/). | ||
|
||
## Changed | ||
## [Unreleased] | ||
### Changed | ||
- Tenancy is enabled from the get go. Assigning a tenant is optional. See "Previous Versions" in the README on upgrading. | ||
- Required jquery-ui version | ||
- How migrations are done, which may be a breaking change from older versions of Plutus | ||
|
||
### Fixed | ||
- Fix loading of jquery-ui files (Fixes https://github.com/mbulat/plutus/issues/58) | ||
|
||
### Added | ||
- Add `Account#amounts` and `Account#entries` to get all amounts and entries, respectively |
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
39 changes: 39 additions & 0 deletions
39
db/migrate/20160422034059_add_tenant_id_and_tenant_type_to_accounts.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,39 @@ | ||
class AddTenantIdAndTenantTypeToAccounts < ActiveRecord::Migration | ||
def up | ||
if Plutus.enable_tenancy | ||
rename_column :plutus_accounts, :tenant_id, :old_tenant_id | ||
Plutus::Account.reset_column_information | ||
end | ||
|
||
add_column :plutus_accounts, :tenant_id, :string | ||
add_column :plutus_accounts, :tenant_type, :string | ||
|
||
Plutus::Account.update_all(tenant_type: Plutus.tenant_class) | ||
|
||
if Plutus.enable_tenancy | ||
Plutus::Account.find_each do |account| | ||
account.update(tenant_id: account.old_tenant_id.to_s) | ||
end | ||
remove_column :plutus_accounts, :old_tenant_id | ||
end | ||
|
||
add_index :plutus_accounts, [:tenant_id, :tenant_type] | ||
end | ||
|
||
def down | ||
if Plutus.enable_tenancy | ||
rename_column :plutus_accounts, :tenant_id, :new_tenant_id | ||
Plutus::Account.reset_column_information | ||
add_column :plutus_accounts, :tenant_id, :integer, index: true | ||
|
||
Plutus::Account.find_each do |account| | ||
account.update(tenant_id: account.new_tenant_id.to_i) | ||
end | ||
|
||
remove_column :plutus_accounts, :new_tenant_id | ||
else | ||
remove_column :plutus_accounts, :tenant_id, :string | ||
end | ||
remove_column :plutus_accounts, :tenant_type, :string | ||
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 |
---|---|---|
|
@@ -151,4 +151,4 @@ DEPENDENCIES | |
web-console (~> 2.0) | ||
|
||
BUNDLED WITH | ||
1.10.6 | ||
1.11.2 |
6 changes: 0 additions & 6 deletions
6
fixture_rails_root/db/migrate/20150722204422_tenant_plutus_tables.rb
This file was deleted.
Oops, something went wrong.
40 changes: 40 additions & 0 deletions
40
..._rails_root/db/migrate/20160422044435_add_tenant_id_and_tenant_type_to_accounts.plutus.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,40 @@ | ||
# This migration comes from plutus (originally 20160422034059) | ||
class AddTenantIdAndTenantTypeToAccounts < ActiveRecord::Migration | ||
def up | ||
if Plutus.enable_tenancy | ||
rename_column :plutus_accounts, :tenant_id, :old_tenant_id | ||
Plutus::Account.reset_column_information | ||
end | ||
|
||
add_column :plutus_accounts, :tenant_id, :string | ||
add_column :plutus_accounts, :tenant_type, :string | ||
|
||
Plutus::Account.update_all(tenant_type: Plutus.tenant_class) | ||
|
||
if Plutus.enable_tenancy | ||
Plutus::Account.find_each do |account| | ||
account.update(tenant_id: account.old_tenant_id.to_s) | ||
end | ||
remove_column :plutus_accounts, :old_tenant_id | ||
end | ||
|
||
add_index :plutus_accounts, [:tenant_id, :tenant_type] | ||
end | ||
|
||
def down | ||
if Plutus.enable_tenancy | ||
rename_column :plutus_accounts, :tenant_id, :new_tenant_id | ||
Plutus::Account.reset_column_information | ||
add_column :plutus_accounts, :tenant_id, :integer, index: true | ||
|
||
Plutus::Account.find_each do |account| | ||
account.update(tenant_id: account.new_tenant_id.to_i) | ||
end | ||
|
||
remove_column :plutus_accounts, :new_tenant_id | ||
else | ||
remove_column :plutus_accounts, :tenant_id, :string | ||
end | ||
remove_column :plutus_accounts, :tenant_type, :string | ||
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