Repository: sequelize/sequelize
File: packages/core/src/abstract-dialect/query-interface.js (JavaScript)

Code before:
   * )
   * ```
   *
   * @param {string} tableName  Name of table to create
   * @param {object} attributes Object representing a list of table attributes to create
   * @param {object} [options] create table and query options
   * @param {Model}  [model] model class
   *
   * @returns {Promise}
   */
  // TODO: remove "schema" option from the option bag, it must be passed as part of "tableName" instead
  async createTable(tableName, attributes, options, model) {
    options = { ...options };

    // TODO: the sqlite implementation of createTableQuery should be improved so it also generates a CREATE UNIQUE INDEX query
    if (model && this.sequelize.dialect.name !== 'sqlite3') {
      options.uniqueKeys = options.uniqueKeys || model.uniqueKeys;
    }

    attributes = mapValues(attributes, attribute => this.sequelize.normalizeAttribute(attribute));

    // Postgres requires special SQL commands for ENUM/ENUM[]
    await this.ensureEnums(tableName, attributes, options, model);

    // Snowflake requires special SQL commands for SEQUENCES
    await this.ensureSequences(tableName, attributes, options, model);

    const modelTable = model?.table;

    if (!tableName.schema && (options.schema || modelTable?.schema)) {
      tableName = this.queryGenerator.extractTableDetails(tableName);
      tableName.schema = modelTable?.schema || options.schema;
    }

    attributes = this.queryGenerator.attributesToSQL(attributes, {
      table: tableName,
      context: 'createTable',
      withoutForeignKeyConstraints: options.withoutForeignKeyConstraints,
      // schema override for multi-tenancy
      schema: options.schema,
    });

    const sql = this.queryGenerator.createTableQuery(tableName, attributes, options);

    return await this.sequelize.queryRaw(sql, options);
  }

  /**
   * Add a new column to a table
   *
   * ```js

Review comment (suggestion):
```suggestion
    await this.ensureSequences(tableName, attributes, options);
```

Oh, and this suggestion.

Code after:
   * )
   * ```
   *
   * @param {string} tableName  Name of table to create
   * @param {object} attributes Object representing a list of table attributes to create
   * @param {object} [options] create table and query options
   * @param {Model}  [model] model class
   *
   * @returns {Promise}
   */
  // TODO: remove "schema" option from the option bag, it must be passed as part of "tableName" instead
  async createTable(tableName, attributes, options, model) {
    options = { ...options };

    // TODO: the sqlite implementation of createTableQuery should be improved so it also generates a CREATE UNIQUE INDEX query
    if (model && this.sequelize.dialect.name !== 'sqlite3') {
      options.uniqueKeys = options.uniqueKeys || model.uniqueKeys;
    }

    attributes = mapValues(attributes, attribute => this.sequelize.normalizeAttribute(attribute));

    // Postgres requires special SQL commands for ENUM/ENUM[]
    await this.ensureEnums(tableName, attributes, options, model);

    // Snowflake requires special SQL commands for SEQUENCES
    await this.ensureSequences(tableName, attributes, options);

    const modelTable = model?.table;

    if (!tableName.schema && (options.schema || modelTable?.schema)) {
      tableName = this.queryGenerator.extractTableDetails(tableName);
      tableName.schema = modelTable?.schema || options.schema;
    }

    attributes = this.queryGenerator.attributesToSQL(attributes, {
      table: tableName,
      context: 'createTable',
      withoutForeignKeyConstraints: options.withoutForeignKeyConstraints,
      // schema override for multi-tenancy
      schema: options.schema,
    });

    const sql = this.queryGenerator.createTableQuery(tableName, attributes, options);

    return await this.sequelize.queryRaw(sql, options);
  }

  /**
   * Add a new column to a table
   *
   * ```js