mirror of
https://github.com/tiennm99/coolify.git
synced 2026-04-17 17:21:04 +00:00
refactor: Optimize UUID generation for cloud provider tokens using chunked processing
This commit is contained in:
@@ -17,13 +17,16 @@ return new class extends Migration
|
|||||||
$table->string('uuid')->nullable()->unique()->after('id');
|
$table->string('uuid')->nullable()->unique()->after('id');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Generate UUIDs for existing records
|
// Generate UUIDs for existing records using chunked processing
|
||||||
$tokens = DB::table('cloud_provider_tokens')->whereNull('uuid')->get();
|
DB::table('cloud_provider_tokens')
|
||||||
foreach ($tokens as $token) {
|
->whereNull('uuid')
|
||||||
DB::table('cloud_provider_tokens')
|
->chunkById(500, function ($tokens) {
|
||||||
->where('id', $token->id)
|
foreach ($tokens as $token) {
|
||||||
->update(['uuid' => (string) new Cuid2]);
|
DB::table('cloud_provider_tokens')
|
||||||
}
|
->where('id', $token->id)
|
||||||
|
->update(['uuid' => (string) new Cuid2]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Make uuid non-nullable after filling in values
|
// Make uuid non-nullable after filling in values
|
||||||
Schema::table('cloud_provider_tokens', function (Blueprint $table) {
|
Schema::table('cloud_provider_tokens', function (Blueprint $table) {
|
||||||
|
|||||||
89
openapi.json
89
openapi.json
@@ -6724,11 +6724,21 @@
|
|||||||
"description": "Get all available Hetzner datacenter locations.",
|
"description": "Get all available Hetzner datacenter locations.",
|
||||||
"operationId": "get-hetzner-locations",
|
"operationId": "get-hetzner-locations",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "cloud_provider_token_uuid",
|
||||||
|
"in": "query",
|
||||||
|
"description": "Cloud provider token UUID. Required if cloud_provider_token_id is not provided.",
|
||||||
|
"required": false,
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "cloud_provider_token_id",
|
"name": "cloud_provider_token_id",
|
||||||
"in": "query",
|
"in": "query",
|
||||||
"description": "Cloud provider token UUID",
|
"description": "Deprecated: Use cloud_provider_token_uuid instead. Cloud provider token UUID.",
|
||||||
"required": true,
|
"required": false,
|
||||||
|
"deprecated": true,
|
||||||
"schema": {
|
"schema": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
@@ -6794,11 +6804,21 @@
|
|||||||
"description": "Get all available Hetzner server types (instance sizes).",
|
"description": "Get all available Hetzner server types (instance sizes).",
|
||||||
"operationId": "get-hetzner-server-types",
|
"operationId": "get-hetzner-server-types",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "cloud_provider_token_uuid",
|
||||||
|
"in": "query",
|
||||||
|
"description": "Cloud provider token UUID. Required if cloud_provider_token_id is not provided.",
|
||||||
|
"required": false,
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "cloud_provider_token_id",
|
"name": "cloud_provider_token_id",
|
||||||
"in": "query",
|
"in": "query",
|
||||||
"description": "Cloud provider token UUID",
|
"description": "Deprecated: Use cloud_provider_token_uuid instead. Cloud provider token UUID.",
|
||||||
"required": true,
|
"required": false,
|
||||||
|
"deprecated": true,
|
||||||
"schema": {
|
"schema": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
@@ -6832,7 +6852,38 @@
|
|||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
"prices": {
|
"prices": {
|
||||||
"type": "array"
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"location": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Datacenter location name"
|
||||||
|
},
|
||||||
|
"price_hourly": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"net": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"gross": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"price_monthly": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"net": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"gross": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"type": "object"
|
"type": "object"
|
||||||
@@ -7107,6 +7158,9 @@
|
|||||||
},
|
},
|
||||||
"422": {
|
"422": {
|
||||||
"$ref": "#\/components\/responses\/422"
|
"$ref": "#\/components\/responses\/422"
|
||||||
|
},
|
||||||
|
"429": {
|
||||||
|
"$ref": "#\/components\/responses\/429"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"security": [
|
"security": [
|
||||||
@@ -10979,6 +11033,31 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"429": {
|
||||||
|
"description": "Rate limit exceeded.",
|
||||||
|
"headers": {
|
||||||
|
"Retry-After": {
|
||||||
|
"description": "Number of seconds to wait before retrying.",
|
||||||
|
"schema": {
|
||||||
|
"type": "integer",
|
||||||
|
"example": 60
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"content": {
|
||||||
|
"application\/json": {
|
||||||
|
"schema": {
|
||||||
|
"properties": {
|
||||||
|
"message": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "Rate limit exceeded. Please try again later."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"securitySchemes": {
|
"securitySchemes": {
|
||||||
|
|||||||
44
openapi.yaml
44
openapi.yaml
@@ -4325,11 +4325,19 @@ paths:
|
|||||||
description: 'Get all available Hetzner datacenter locations.'
|
description: 'Get all available Hetzner datacenter locations.'
|
||||||
operationId: get-hetzner-locations
|
operationId: get-hetzner-locations
|
||||||
parameters:
|
parameters:
|
||||||
|
-
|
||||||
|
name: cloud_provider_token_uuid
|
||||||
|
in: query
|
||||||
|
description: 'Cloud provider token UUID. Required if cloud_provider_token_id is not provided.'
|
||||||
|
required: false
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
-
|
-
|
||||||
name: cloud_provider_token_id
|
name: cloud_provider_token_id
|
||||||
in: query
|
in: query
|
||||||
description: 'Cloud provider token UUID'
|
description: 'Deprecated: Use cloud_provider_token_uuid instead. Cloud provider token UUID.'
|
||||||
required: true
|
required: false
|
||||||
|
deprecated: true
|
||||||
schema:
|
schema:
|
||||||
type: string
|
type: string
|
||||||
responses:
|
responses:
|
||||||
@@ -4357,11 +4365,19 @@ paths:
|
|||||||
description: 'Get all available Hetzner server types (instance sizes).'
|
description: 'Get all available Hetzner server types (instance sizes).'
|
||||||
operationId: get-hetzner-server-types
|
operationId: get-hetzner-server-types
|
||||||
parameters:
|
parameters:
|
||||||
|
-
|
||||||
|
name: cloud_provider_token_uuid
|
||||||
|
in: query
|
||||||
|
description: 'Cloud provider token UUID. Required if cloud_provider_token_id is not provided.'
|
||||||
|
required: false
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
-
|
-
|
||||||
name: cloud_provider_token_id
|
name: cloud_provider_token_id
|
||||||
in: query
|
in: query
|
||||||
description: 'Cloud provider token UUID'
|
description: 'Deprecated: Use cloud_provider_token_uuid instead. Cloud provider token UUID.'
|
||||||
required: true
|
required: false
|
||||||
|
deprecated: true
|
||||||
schema:
|
schema:
|
||||||
type: string
|
type: string
|
||||||
responses:
|
responses:
|
||||||
@@ -4372,7 +4388,7 @@ paths:
|
|||||||
schema:
|
schema:
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
properties: { id: { type: integer }, name: { type: string }, description: { type: string }, cores: { type: integer }, memory: { type: number }, disk: { type: integer }, prices: { type: array } }
|
properties: { id: { type: integer }, name: { type: string }, description: { type: string }, cores: { type: integer }, memory: { type: number }, disk: { type: integer }, prices: { type: array, items: { type: object, properties: { location: { type: string, description: 'Datacenter location name' }, price_hourly: { type: object, properties: { net: { type: string }, gross: { type: string } } }, price_monthly: { type: object, properties: { net: { type: string }, gross: { type: string } } } } } } }
|
||||||
type: object
|
type: object
|
||||||
'401':
|
'401':
|
||||||
$ref: '#/components/responses/401'
|
$ref: '#/components/responses/401'
|
||||||
@@ -4528,6 +4544,8 @@ paths:
|
|||||||
$ref: '#/components/responses/404'
|
$ref: '#/components/responses/404'
|
||||||
'422':
|
'422':
|
||||||
$ref: '#/components/responses/422'
|
$ref: '#/components/responses/422'
|
||||||
|
'429':
|
||||||
|
$ref: '#/components/responses/429'
|
||||||
security:
|
security:
|
||||||
-
|
-
|
||||||
bearerAuth: []
|
bearerAuth: []
|
||||||
@@ -7005,6 +7023,22 @@ components:
|
|||||||
type: array
|
type: array
|
||||||
items: { type: string }
|
items: { type: string }
|
||||||
type: object
|
type: object
|
||||||
|
'429':
|
||||||
|
description: 'Rate limit exceeded.'
|
||||||
|
headers:
|
||||||
|
Retry-After:
|
||||||
|
description: 'Number of seconds to wait before retrying.'
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
example: 60
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
properties:
|
||||||
|
message:
|
||||||
|
type: string
|
||||||
|
example: 'Rate limit exceeded. Please try again later.'
|
||||||
|
type: object
|
||||||
securitySchemes:
|
securitySchemes:
|
||||||
bearerAuth:
|
bearerAuth:
|
||||||
type: http
|
type: http
|
||||||
|
|||||||
Reference in New Issue
Block a user