@@ -72,16 +72,26 @@ const migrateSubscriptionsToUsageBased = async () => {
72
72
73
73
const failedWorkspaces = [ ]
74
74
const workspacesWithoutSubscription = [ ]
75
+ const workspacesWithoutStripeId = [ ]
75
76
77
+ let i = 0
76
78
for ( const workspace of workspacesWithPaidPlan ) {
79
+ i += 1
77
80
console . log (
81
+ `(${ i } / ${ workspacesWithPaidPlan . length } )` ,
78
82
'Migrating workspace:' ,
79
83
workspace . id ,
80
84
workspace . name ,
85
+ workspace . stripeId ,
81
86
JSON . stringify ( workspace . members . map ( ( member ) => member . user . email ) )
82
87
)
83
88
if ( ! workspace . stripeId ) {
84
89
console . log ( 'No stripe ID, skipping...' )
90
+ workspacesWithoutStripeId . push ( workspace )
91
+ writeFileSync (
92
+ './workspacesWithoutStripeId.json' ,
93
+ JSON . stringify ( workspacesWithoutStripeId , null , 2 )
94
+ )
85
95
continue
86
96
}
87
97
@@ -97,6 +107,10 @@ const migrateSubscriptionsToUsageBased = async () => {
97
107
if ( ! currentSubscription ) {
98
108
console . log ( 'No current subscription in workspace:' , workspace . id )
99
109
workspacesWithoutSubscription . push ( workspace )
110
+ writeFileSync (
111
+ './workspacesWithoutSubscription.json' ,
112
+ JSON . stringify ( workspacesWithoutSubscription )
113
+ )
100
114
continue
101
115
}
102
116
@@ -126,6 +140,10 @@ const migrateSubscriptionsToUsageBased = async () => {
126
140
workspace . id
127
141
)
128
142
failedWorkspaces . push ( workspace )
143
+ writeFileSync (
144
+ './failedWorkspaces.json' ,
145
+ JSON . stringify ( failedWorkspaces , null , 2 )
146
+ )
129
147
continue
130
148
}
131
149
@@ -255,16 +273,6 @@ const migrateSubscriptionsToUsageBased = async () => {
255
273
} )
256
274
}
257
275
}
258
-
259
- writeFileSync (
260
- './failedWorkspaces.json' ,
261
- JSON . stringify ( failedWorkspaces , null , 2 )
262
- )
263
-
264
- writeFileSync (
265
- './workspacesWithoutSubscription.json' ,
266
- JSON . stringify ( workspacesWithoutSubscription , null , 2 )
267
- )
268
276
}
269
277
270
278
migrateSubscriptionsToUsageBased ( )
0 commit comments