Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #346 of daniellee/systemmethods
# By Daniel Lee # Via Daniel Lee * pr/n346_daniellee: Implemented CurrentUser SystemMethod for SqlServer Implemented CurrentDateTime SystemMethod for MySql New CurrentUser SystemMethod and implemented for Postgres Add CurrentUTCDateTime SystemMethod to Postgres
- Loading branch information
Showing
8 changed files
with
141 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/FluentMigrator.Tests/Unit/Generators/MySql/MySqlSystemMethodsTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System.Data; | ||
using FluentMigrator.Expressions; | ||
using FluentMigrator.Model; | ||
using FluentMigrator.Runner.Generators.MySql; | ||
using NUnit.Framework; | ||
using NUnit.Should; | ||
|
||
namespace FluentMigrator.Tests.Unit.Generators.MySql | ||
{ | ||
[TestFixture] | ||
public class MySqlSystemMethodsTests | ||
{ | ||
private MySqlGenerator generator; | ||
|
||
[SetUp] | ||
public void SetUp() | ||
{ | ||
generator = new MySqlGenerator(); | ||
} | ||
|
||
[Test] | ||
public void CanUseSystemMethodCurrentDateTimeAsADefaultValueForAColumn() | ||
{ | ||
var columnDefinition = new ColumnDefinition { Name = "NewColumn", Size = 15, Type = null, CustomType = "TIMESTAMP", DefaultValue = SystemMethods.CurrentDateTime }; | ||
var expression = new CreateColumnExpression {Column = columnDefinition, TableName = "NewTable"}; | ||
|
||
string sql = generator.Generate(expression); | ||
|
||
sql.ShouldBe("ALTER TABLE `NewTable` ADD COLUMN `NewColumn` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters