Skip to content

Commit

Permalink
Revert "Fix SQLite not doing rollback when altering columns fails (kn…
Browse files Browse the repository at this point in the history
…ex#4336)"

Reverts knex#4336. Now that knex#4189 has been merged, we can savely revert this PR.
  • Loading branch information
nickrum committed Dec 15, 2021
1 parent a7a08db commit e72052e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/dialects/sqlite3/schema/ddl.js
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions lib/dialects/sqlite3/schema/sqlite-tablecompiler.js
Expand Up @@ -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);
},
});
Expand Down
6 changes: 3 additions & 3 deletions test/integration2/schema/alter.spec.js
Expand Up @@ -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();
});
Expand All @@ -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'",
]);
});
});
Expand Down

0 comments on commit e72052e

Please sign in to comment.