Merge branch 'develop' into ccb
This commit is contained in:
commit
92193d499a
13
dictation_server/db/migrations/054-add_license_index.sql
Normal file
13
dictation_server/db/migrations/054-add_license_index.sql
Normal file
@ -0,0 +1,13 @@
|
||||
-- +migrate Up
|
||||
ALTER TABLE `license_orders` ADD INDEX `idx_po_number` (po_number);
|
||||
ALTER TABLE `license_orders` ADD INDEX `idx_from_account_id` (from_account_id);
|
||||
ALTER TABLE `license_orders` ADD INDEX `idx_status` (status);
|
||||
ALTER TABLE `card_licenses` ADD INDEX `idx_card_license_key` (card_license_key);
|
||||
ALTER TABLE `licenses` ADD INDEX `idx_status` (status);
|
||||
|
||||
-- +migrate Down
|
||||
ALTER TABLE `license_orders` DROP INDEX `idx_po_number`;
|
||||
ALTER TABLE `license_orders` DROP INDEX `idx_from_account_id`;
|
||||
ALTER TABLE `license_orders` DROP INDEX `idx_status`;
|
||||
ALTER TABLE `card_licenses` DROP INDEX `idx_card_license_key`;
|
||||
ALTER TABLE `licenses` DROP INDEX `idx_status`;
|
||||
@ -81,6 +81,7 @@ export class LicensesRepositoryService {
|
||||
},
|
||||
],
|
||||
comment: `${context.getTrackingId()}_${new Date().toUTCString()}`,
|
||||
lock: { mode: 'pessimistic_write' },
|
||||
});
|
||||
// 重複があった場合はエラーを返却する
|
||||
if (isPoNumberDuplicated) {
|
||||
@ -193,6 +194,7 @@ export class LicensesRepositoryService {
|
||||
card_license_key: In(generateKeys),
|
||||
},
|
||||
comment: `${context.getTrackingId()}_${new Date().toUTCString()}`,
|
||||
lock: { mode: 'pessimistic_write' },
|
||||
});
|
||||
if (existingCardLicenses.length > 0) {
|
||||
// 重複分を配列から削除
|
||||
@ -292,6 +294,7 @@ export class LicensesRepositoryService {
|
||||
card_license_key: licenseKey,
|
||||
},
|
||||
comment: `${context.getTrackingId()}_${new Date().toUTCString()}`,
|
||||
lock: { mode: 'pessimistic_write' },
|
||||
});
|
||||
// カードライセンスが存在しなければエラー
|
||||
if (!targetCardLicense) {
|
||||
@ -602,6 +605,7 @@ export class LicensesRepositoryService {
|
||||
allocated_user_id: userId,
|
||||
},
|
||||
comment: `${context.getTrackingId()}_${new Date().toUTCString()}`,
|
||||
lock: { mode: 'pessimistic_write' },
|
||||
});
|
||||
|
||||
// 既にライセンスが割り当てられているなら、割り当てを解除
|
||||
@ -717,6 +721,7 @@ export class LicensesRepositoryService {
|
||||
status: LICENSE_ALLOCATED_STATUS.ALLOCATED,
|
||||
},
|
||||
comment: `${context.getTrackingId()}_${new Date().toUTCString()}`,
|
||||
lock: { mode: 'pessimistic_write' },
|
||||
});
|
||||
|
||||
// ライセンスが割り当てられていない場合はエラー
|
||||
@ -776,6 +781,7 @@ export class LicensesRepositoryService {
|
||||
status: LICENSE_ISSUE_STATUS.ISSUE_REQUESTING,
|
||||
},
|
||||
comment: `${context.getTrackingId()}_${new Date().toUTCString()}`,
|
||||
lock: { mode: 'pessimistic_write' },
|
||||
});
|
||||
|
||||
// キャンセル対象の注文が存在しない場合エラー
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user