SQLite + Delete.Column(): table column still there after migration
See original GitHub issueThis is very likely an issue with my usage, but I haven’t found any indication as to why in the docs or on forums. I have an SQLite database and the following migration:
[Migration(3)]
public class _003_add_surname_column : Migration
{
public override void Up()
{
Rename.Column("name").OnTable("Test").To("forename");
Alter.Table("Test").AddColumn("surname").AsString(50).Nullable();
}
public override void Down()
{
Delete.Column("surname").FromTable("Test");
Rename.Column("forename").OnTable("Test").To("name");
}
}
Migrating up works fine. Migrating down performs the column rename (from “forename” to “name”), but leaves the “surname” column in the table. I expected that column to be gone. Am I missing something? Or is that the intended behaviour?
Using FluentMigrator version 1.6.2, System.Data.SQLite.1.0.99.0, .NET 4.5.1.
Thanks!
Issue Analytics
- State:
- Created 6 years ago
- Reactions:6
- Comments:25 (7 by maintainers)
Top Results From Across the Web
sql - Drop column from SQLite table
Go to the tab, "Database Structure"; Select you table Select Modify table (just under the tabs); Select the column you want to delete;...
Read more >Dropping Columns Like It's Hot
Following the steps above, let's try to drop the age column. First we'll rename the existing table into users_old , and create the...
Read more >Overview of the SQL DELETE Column from an existing ...
Right-click on the column we want to remove and click on Delete as shown in the following image. SQL DELETE column using SSMS...
Read more >ALTER TABLE
The DROP COLUMN syntax is used to remove an existing column from a table. ... The command is only successful if the schema...
Read more >Fixing ALTER TABLE errors with Flask-Migrate and SQLite
With SQLite, however, the ALTER TABLE command only supports adding or renaming columns. ... (venv) $ flask db migrate -m "remove a column"....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
dotnet is considering to update the version of sqlite: https://github.com/dotnet/efcore/issues/24834 Also the System.Data.SQLite.Core will be updated very soon: https://system.data.sqlite.org/index.html/doc/trunk/www/news.wiki
I think for a start, FluentMigrator should probably throw and exception when an unsupported migration is run. Then for later, look at if it’s possible to do the workaround hacks with renaming table, create new table, copy data from old table.