@@ -31,16 +31,31 @@ export default async function setMigration(options: Record<string, unknown>) {
3131 process . exit ( 1 ) ;
3232 }
3333
34- if ( disable ) {
35- const config = await getStorageConfig ( ) ;
36- const selectedOrg = getSelectedOrganization ( ) ;
37- const finalConfig = {
38- ...config ,
39- ...( selectedOrg && ! config . organizationId
40- ? { organizationId : selectedOrg }
41- : { } ) ,
42- } ;
34+ if (
35+ disable &&
36+ ( bucket !== undefined ||
37+ endpoint !== undefined ||
38+ region !== undefined ||
39+ accessKey !== undefined ||
40+ secretKey !== undefined )
41+ ) {
42+ printFailure (
43+ context ,
44+ 'Cannot use --disable with --bucket, --endpoint, --region, --access-key, or --secret-key'
45+ ) ;
46+ process . exit ( 1 ) ;
47+ }
4348
49+ const config = await getStorageConfig ( ) ;
50+ const selectedOrg = getSelectedOrganization ( ) ;
51+ const finalConfig = {
52+ ...config ,
53+ ...( selectedOrg && ! config . organizationId
54+ ? { organizationId : selectedOrg }
55+ : { } ) ,
56+ } ;
57+
58+ if ( disable ) {
4459 const { error } = await setBucketMigration ( name , {
4560 dataMigration : { enabled : false } ,
4661 config : finalConfig ,
@@ -63,15 +78,6 @@ export default async function setMigration(options: Record<string, unknown>) {
6378 process . exit ( 1 ) ;
6479 }
6580
66- const config = await getStorageConfig ( ) ;
67- const selectedOrg = getSelectedOrganization ( ) ;
68- const finalConfig = {
69- ...config ,
70- ...( selectedOrg && ! config . organizationId
71- ? { organizationId : selectedOrg }
72- : { } ) ,
73- } ;
74-
7581 const { error } = await setBucketMigration ( name , {
7682 dataMigration : {
7783 enabled : true ,
0 commit comments