mirror of
https://github.com/knex/knex.git
synced 2025-12-28 15:38:41 +00:00
This commit is contained in:
parent
bb7de096dc
commit
e2a425e4e3
@ -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) {
|
||||
|
||||
@ -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);
|
||||
},
|
||||
});
|
||||
|
||||
@ -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'",
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user