-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor SQL scripts to update orders schema:
As we use orders to represent subscriptions/memberships, delete the memberships SQL scripts, and add appropriate attributes to the quotas and orders tables. Renumber the scripts for flyway migrations. refs #65
- Loading branch information
Showing
17 changed files
with
35 additions
and
89 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions
6
...n/resources/db/migrations/V1.12__Alter_Quotas_Add_Unique_Constraint_OrderId_QuotaType.sql
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 @@ | ||
--- Note that this is completed in k8s via the Dockerfile | ||
--- or via a shell script in non-k8s development envs | ||
|
||
--- Add a unique constraint to the quotas table for the orderId and quotaType columns | ||
CREATE UNIQUE INDEX quotas_order_id_quota_type_idx | ||
ON quotas USING btree(orderId, quotaType); |
6 changes: 0 additions & 6 deletions
6
...ources/db/migrations/V1.15__Alter_Quotas_Add_Unique_Constraint_MembershipId_QuotaType.sql
This file was deleted.
Oops, something went wrong.
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
src/main/resources/db/migrations/V1.2__Insert_Standard_Quotas.sql
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,14 +1,14 @@ | ||
-- Insert quotas for portal and storage quotas; | ||
|
||
-- 1GB base storage limit | ||
INSERT INTO quotas (object, quotaType, softLimit, hardLimit, totalUsage, unit, membershipId, subject) | ||
INSERT INTO quotas (object, quotaType, softLimit, hardLimit, totalUsage, unit, orderId, subject) | ||
VALUES ('quota', 'storage', 1073741824.0, 1181116006.4, NULL, 'byte', NULL, NULL); | ||
|
||
-- 1TB base hosted repository storage limit | ||
INSERT INTO quotas (object, quotaType, softLimit, hardLimit, totalUsage, unit, membershipId, subject) | ||
INSERT INTO quotas (object, quotaType, softLimit, hardLimit, totalUsage, unit, orderId, subject) | ||
VALUES ('quota', 'repository_storage', 1099511627776.0, 1209462790553.6, NULL, 'byte', NULL, | ||
NULL); | ||
|
||
-- Single base branded portal limit | ||
INSERT INTO quotas (object, quotaType, softLimit, hardLimit, totalUsage, unit, membershipId, subject) | ||
INSERT INTO quotas (object, quotaType, softLimit, hardLimit, totalUsage, unit, orderId, subject) | ||
VALUES ('quota', 'portal', 1.0, 1.0, NULL, 'portal', NULL, NULL); |
7 changes: 7 additions & 0 deletions
7
src/main/resources/db/migrations/V1.3__Alter_Quotas_Add_Order_FK.sql
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,7 @@ | ||
--- Note that this is completed in k8s via the Dockerfile | ||
--- or via a shell script in non-k8s development envs | ||
|
||
--- Add the order id foreign key constraint | ||
ALTER TABLE quotas | ||
ADD CONSTRAINT quotas_order_id_fk | ||
FOREIGN KEY (orderId) REFERENCES orders (id) ON DELETE CASCADE; |
53 changes: 0 additions & 53 deletions
53
src/main/resources/db/migrations/V1.3__Create_Memberships_Table.sql
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
src/main/resources/db/migrations/V1.4__Alter_Quotas_Add_Membership_FK.sql
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
7 changes: 0 additions & 7 deletions
7
src/main/resources/db/migrations/V1.6__Alter_Memberships_Add_Customer_FK.sql
This file was deleted.
Oops, something went wrong.
File renamed without changes.
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
File renamed without changes.
7 changes: 0 additions & 7 deletions
7
src/main/resources/db/migrations/V1.9__Alter_Memberships_Add_Product_FK.sql
This file was deleted.
Oops, something went wrong.
File renamed without changes.