appbuild-oceanbase-console 1.12.0 → 1.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/sdk.js CHANGED
@@ -14048,26 +14048,29 @@ class SchemaMigration {
14048
14048
  this._currentSchema = schema;
14049
14049
  const operations = [];
14050
14050
  const skippedBuiltIns = [];
14051
- // If databaseId is empty, create a database with id "default"
14051
+ // Auto-create database if it doesn't exist
14052
+ // If databaseId is empty, use "default" as the database id
14052
14053
  let databaseId = schema.databaseId;
14053
14054
  if (!databaseId || databaseId.trim() === '') {
14054
14055
  databaseId = 'default';
14055
- try {
14056
- yield this.databases.create({
14057
- databaseId: databaseId,
14058
- name: 'default',
14059
- enabled: true
14060
- });
14061
- }
14062
- catch (error) {
14063
- // If database already exists, that's fine
14064
- if (!(error instanceof AppwriteException && error.code === 409)) {
14065
- throw error;
14066
- }
14056
+ }
14057
+ // Try to create the database if it doesn't exist
14058
+ // If it already exists (409 error), that's fine - continue execution
14059
+ try {
14060
+ yield this.databases.create({
14061
+ databaseId: databaseId,
14062
+ name: databaseId,
14063
+ enabled: true
14064
+ });
14065
+ }
14066
+ catch (error) {
14067
+ // If database already exists, that's fine
14068
+ if (!(error instanceof AppwriteException && error.code === 409)) {
14069
+ throw error;
14067
14070
  }
14068
- // Update schema.databaseId for later use
14069
- schema.databaseId = databaseId;
14070
14071
  }
14072
+ // Update schema.databaseId for later use
14073
+ schema.databaseId = databaseId;
14071
14074
  // Get current tables
14072
14075
  const currentTables = yield this.databases.listTables({
14073
14076
  databaseId: databaseId,