Fluent migrations for .NET!
This project’s repository has been moved to the following github repository:
- Project Home: http://www.github.com/schambers/fluentmigrator/
Thanks!
- Sean Chambers
fluent migrations for .net
Fluent migrations for .NET!
This project’s repository has been moved to the following github repository:
Thanks!
- Sean Chambers
It would be nice if there was a way to alter an existing column without deleting and recreating it, for example when you want to change a data type or default value but retain all the data. Maybe something like:
Alter.Column("foo").OnTable("bar").AsInt16().WithDefaultValue(0);
Deleting a column with a default value throws an error in SQL Server, since SQL Server creates a default constraint to enforce the default value. If you are dropping a column, you don't need the default value constrain anymore either, so it should be safe to delete. Here's some code to do it (replace line 71 of SqlServerGenerator.cs with this, if it isn't horribly mangled by the editor):
public override string Generate(DeleteColumnExpression expression)
{
// before we drop a column, we have to drop any default value constraints in SQL Server
string sql = @"
DECLARE @default sysname, @Sql nvarchar(max);
-- get name of default constraint
SELECT @default = name
FROM sys.default_constraints
WHERE parent_object_id = object_id('{0}')
AND type = 'D'
AND parent_column_id = (
SELECT column_id
FROM sys.columns
WHERE object_id = object_id('{0}')
AND name = '{1}'
);
-- create alter table command as string and run it
SET @sql = N'ALTER TABLE [{0}] DROP CONSTRAINT ' + @default;
EXEC sp_executesql @sql;
-- now we can finally drop column
ALTER TABLE [{0}] DROP COLUMN [{1}];";
return FormatExpression(sql, expression.TableName, expression.ColumnName);
}
When specifying a working directory, it is not looking at the setting in the Down() methods when rolling back
It may be worthwhile to create an Expressoin that can execute raw sql. Would need to add a new RawExpression and then add it to the ProcessorBase class so that the visitor can traverse it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.