-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename StripeSubscription to StripeConnectSubscription
- Loading branch information
Showing
6 changed files
with
99 additions
and
34 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
6 changes: 3 additions & 3 deletions
6
...ps/stripe/adapters/stripe_subscription.ex → ...e/adapters/stripe_connect_subscription.ex
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
65 changes: 65 additions & 0 deletions
65
priv/repo/migrations/20161123150943_rename_stripe_connect_subscriptions.exs
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,65 @@ | ||
defmodule CodeCorps.Repo.Migrations.RenameStripeConnectSubscriptions do | ||
use Ecto.Migration | ||
|
||
def up do | ||
execute "ALTER TABLE stripe_subscriptions DROP CONSTRAINT stripe_subscriptions_stripe_connect_plan_id_fkey" | ||
execute "ALTER TABLE stripe_subscriptions DROP CONSTRAINT IF EXISTS stripe_subscriptions_pkey" | ||
|
||
execute "DROP INDEX IF EXISTS stripe_subscriptions_pkey" | ||
|
||
drop unique_index(:stripe_subscriptions, [:id_from_stripe]) | ||
|
||
drop index(:stripe_subscriptions, [:user_id]) | ||
drop index(:stripe_subscriptions, [:plan_id_from_stripe]) | ||
drop index(:stripe_subscriptions, [:stripe_connect_plan_id]) | ||
|
||
rename table(:stripe_subscriptions), to: table(:stripe_connect_subscriptions) | ||
|
||
execute "CREATE UNIQUE INDEX stripe_connect_subscriptions_pkey ON stripe_connect_subscriptions USING btree (id)" | ||
|
||
execute "ALTER SEQUENCE stripe_subscriptions_id_seq RENAME TO stripe_connect_subscriptions_id_seq" | ||
|
||
execute "ALTER TABLE stripe_connect_subscriptions RENAME CONSTRAINT stripe_subscriptions_user_id_fkey TO stripe_connect_subscriptions_user_id_fkey" | ||
|
||
create index(:stripe_connect_subscriptions, [:user_id]) | ||
create index(:stripe_connect_subscriptions, [:plan_id_from_stripe]) | ||
create index(:stripe_connect_subscriptions, [:stripe_connect_plan_id]) | ||
|
||
create unique_index(:stripe_connect_subscriptions, [:id_from_stripe], unique: true) | ||
|
||
alter table(:stripe_connect_subscriptions) do | ||
modify :stripe_connect_plan_id, references(:stripe_connect_plans) | ||
end | ||
end | ||
|
||
def down do | ||
execute "ALTER TABLE stripe_connect_subscriptions DROP CONSTRAINT stripe_connect_subscriptions_stripe_connect_plan_id_fkey" | ||
execute "ALTER TABLE stripe_connect_subscriptions DROP CONSTRAINT IF EXISTS stripe_connect_subscriptions_pkey" | ||
|
||
execute "DROP INDEX stripe_connect_subscriptions_pkey" | ||
|
||
drop_if_exists index(:stripe_connect_subscriptions, [:user_id]) | ||
drop_if_exists index(:stripe_connect_subscriptions, [:plan_id_from_stripe]) | ||
drop_if_exists index(:stripe_connect_subscriptions, [:stripe_connect_plan_id]) | ||
|
||
drop_if_exists unique_index(:stripe_connect_subscriptions, [:id_from_stripe]) | ||
|
||
rename table(:stripe_connect_subscriptions), to: table(:stripe_subscriptions) | ||
|
||
execute "CREATE UNIQUE INDEX stripe_subscriptions_pkey ON stripe_subscriptions USING btree (id)" | ||
|
||
execute "ALTER SEQUENCE stripe_connect_subscriptions_id_seq RENAME TO stripe_subscriptions_id_seq" | ||
|
||
execute "ALTER TABLE stripe_subscriptions RENAME CONSTRAINT stripe_connect_subscriptions_user_id_fkey TO stripe_subscriptions_user_id_fkey" | ||
|
||
create index(:stripe_subscriptions, [:user_id]) | ||
create index(:stripe_subscriptions, [:plan_id_from_stripe]) | ||
create index(:stripe_subscriptions, [:stripe_connect_plan_id]) | ||
|
||
create unique_index(:stripe_subscriptions, [:id_from_stripe]) | ||
|
||
alter table(:stripe_subscriptions) do | ||
modify :stripe_connect_plan_id, references(:stripe_connect_plans) | ||
end | ||
end | ||
end |
4 changes: 2 additions & 2 deletions
4
...ipe/adapters/stripe_subscription_test.exs → ...ters/stripe_connect_subscription_test.exs
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 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