diff --git a/lib/dialects/sqlite3/schema/ddl.js b/lib/dialects/sqlite3/schema/ddl.js index 2424d6955..0e2a9db80 100644 --- a/lib/dialects/sqlite3/schema/ddl.js +++ b/lib/dialects/sqlite3/schema/ddl.js @@ -126,7 +126,7 @@ class SQLite3_DDL { const newTable = compileCreateTable(parsedTable, this.wrap); - return this.alter(newTable, createIndices); + return this.generateAlterCommands(newTable, createIndices); } async dropColumn(columns) { diff --git a/lib/dialects/sqlite3/schema/sqlite-tablecompiler.js b/lib/dialects/sqlite3/schema/sqlite-tablecompiler.js index 0ff6f5382..2c8271f3f 100644 --- a/lib/dialects/sqlite3/schema/sqlite-tablecompiler.js +++ b/lib/dialects/sqlite3/schema/sqlite-tablecompiler.js @@ -61,9 +61,9 @@ class TableCompiler_SQLite3 extends TableCompiler { this.pushQuery({ sql: `PRAGMA table_info(${this.tableName()})`, - output(pragma) { + statementsProducer(pragma, connection) { return compiler.client - .ddl(compiler, pragma, this.connection) + .ddl(compiler, pragma, connection) .alterColumn(columnsInfo); }, }); diff --git a/test/integration2/schema/alter.spec.js b/test/integration2/schema/alter.spec.js index 46281232e..0df81922c 100644 --- a/test/integration2/schema/alter.spec.js +++ b/test/integration2/schema/alter.spec.js @@ -170,7 +170,7 @@ describe('Schema', () => { ); }); - it.skip('generates correct SQL commands when altering columns', async () => { + it('generates correct SQL commands when altering columns', async () => { const builder = knex.schema.alterTable('alter_table', (table) => { table.string('column_integer').alter(); }); @@ -180,8 +180,8 @@ describe('Schema', () => { expect(queries.sql).to.deep.equal([ "CREATE TABLE `_knex_temp_alter111` (`column_integer` varchar(255), `column_string` varchar(255), `column_datetime` datetime, `column_defaultTo` integer DEFAULT '0', `column_notNullable` varchar(255) NOT NULL, `column_defaultToAndNotNullable` datetime NOT NULL DEFAULT '0', `column_nullable` boolean NULL)", 'INSERT INTO _knex_temp_alter111 SELECT * FROM alter_table;', - 'DROP TABLE "alter_table"', - 'ALTER TABLE "_knex_temp_alter111" RENAME TO "alter_table"', + "DROP TABLE 'alter_table'", + "ALTER TABLE '_knex_temp_alter111' RENAME TO 'alter_table'", ]); }); });