import {
  type ClearDatabaseOptions,
  type CreateSchemaOptions,
  type DropSchemaOptions,
  type EnsureDatabaseOptions,
  type EntityMetadata,
  type ISchemaGenerator,
  type MikroORM,
  type Options,
  type Transaction,
  type UpdateSchemaOptions,
} from '@mikro-orm/core';
import { AbstractSchemaGenerator } from '@mikro-orm/core/schema';
import type { SchemaDifference } from '../typings.js';
import { DatabaseSchema } from './DatabaseSchema.js';
import type { AbstractSqlDriver } from '../AbstractSqlDriver.js';
import type { SchemaHelper } from './SchemaHelper.js';
/** Generates and manages SQL database schemas based on entity metadata. Supports create, update, and drop operations. */
export declare class SqlSchemaGenerator extends AbstractSchemaGenerator<AbstractSqlDriver> implements ISchemaGenerator {
  protected readonly helper: SchemaHelper;
  protected readonly options: NonNullable<Options['schemaGenerator']>;
  protected lastEnsuredDatabase?: string;
  static register(orm: MikroORM): void;
  create(options?: CreateSchemaOptions): Promise<void>;
  /**
   * Returns true if the database was created.
   */
  ensureDatabase(options?: EnsureDatabaseOptions): Promise<boolean>;
  getTargetSchema(schema?: string): DatabaseSchema;
  protected getOrderedMetadata(schema?: string): EntityMetadata[];
  getCreateSchemaSQL(options?: CreateSchemaOptions): Promise<string>;
  drop(options?: DropSchemaOptions): Promise<void>;
  createNamespace(name: string): Promise<void>;
  dropNamespace(name: string): Promise<void>;
  clear(options?: ClearDatabaseOptions): Promise<void>;
  getDropSchemaSQL(options?: Omit<DropSchemaOptions, 'dropDb'>): Promise<string>;
  private getSchemaName;
  update(options?: UpdateSchemaOptions<DatabaseSchema>): Promise<void>;
  getUpdateSchemaSQL(options?: UpdateSchemaOptions<DatabaseSchema>): Promise<string>;
  getUpdateSchemaMigrationSQL(options?: UpdateSchemaOptions<DatabaseSchema>): Promise<{
    up: string;
    down: string;
  }>;
  private prepareSchemaForComparison;
  diffToSQL(
    schemaDiff: SchemaDifference,
    options: {
      wrap?: boolean;
      safe?: boolean;
      dropTables?: boolean;
      schema?: string;
    },
  ): string;
  /**
   * We need to drop foreign keys first for all tables to allow dropping PK constraints.
   */
  private preAlterTable;
  /**
   * creates new database and connects to it
   */
  createDatabase(
    name?: string,
    options?: {
      skipOnConnect?: boolean;
    },
  ): Promise<void>;
  dropDatabase(name?: string): Promise<void>;
  execute(
    sql: string,
    options?: {
      wrap?: boolean;
      ctx?: Transaction;
    },
  ): Promise<void>;
  dropTableIfExists(name: string, schema?: string): Promise<void>;
  private wrapSchema;
  private append;
  private matchName;
  private isTableSkipped;
  /**
   * Sorts views by their dependencies so that views depending on other views are created after their dependencies.
   * Uses topological sort based on view definition string matching.
   */
  private sortViewsByDependencies;
  private escapeRegExp;
}
export { SqlSchemaGenerator as SchemaGenerator };
