1

Closed

SQLite does not have ALTER COLUMN

description

There is a little problem for SQLite. There is no ALTER COLUMN

this is generated:

-- ADDED TABLE Table1 COLUMN phone
ALTER TABLE [Table1] ADD [phone];
-- Table1 from [name] VARCHAR NOT NULL to [name] VARCHAR (50) NOT NULL
ALTER TABLE [Table1] ALTER COLUMN [name] VARCHAR (50) NOT NULL;

There is a schema comparation.

file attachments

Closed Nov 21, 2015 at 4:13 PM by Martinjw
Specific "Alter Table" command should no longer appear. The workaround (clone table) isn't implemented, but we may consider this again later

comments

Martinjw wrote Sep 2, 2015 at 10:17 AM

Yes, it makes our life a little difficult when trying to change a SQLite schema...

What you have to do:
  1. CREATE TABLE New_X
  2. INSERT INTO New_X SELECT * FROM X
  3. DROP TABLE X
  4. ALTER TABLE New_X RENAME TO X
    Plus re-create constraints.
    This could be generated, instead of the ALTER TABLE X ALTER COLUMN ...
It's a little long, but having this generated for you means you spend less time writing it yourself manually.