mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Simplified syntax for clob fields
--HG-- branch : dev
This commit is contained in:
@@ -165,7 +165,7 @@ features:
|
|||||||
interpreter.Visit(bodyRecord);
|
interpreter.Visit(bodyRecord);
|
||||||
Assert.That(sw.ToString().Contains("SchemaBuilder.CreateTable(\"TEST_BodyRecord"));
|
Assert.That(sw.ToString().Contains("SchemaBuilder.CreateTable(\"TEST_BodyRecord"));
|
||||||
Assert.That(sw.ToString().Contains(".ContentPartVersionRecord()"));
|
Assert.That(sw.ToString().Contains(".ContentPartVersionRecord()"));
|
||||||
Assert.That(sw.ToString().Contains(".Column(\"Text\", DbType.String, column => column.WithLength(10000))"));
|
Assert.That(sw.ToString().Contains(".Column(\"Text\", DbType.String, column => column.Unlimited())"));
|
||||||
Assert.That(sw.ToString().Contains(".Column(\"Format\", DbType.String, column => column.WithLength(42))"));
|
Assert.That(sw.ToString().Contains(".Column(\"Format\", DbType.String, column => column.WithLength(42))"));
|
||||||
Assert.That(!sw.ToString().Contains("ContentItemRecord_id"));
|
Assert.That(!sw.ToString().Contains("ContentItemRecord_id"));
|
||||||
}
|
}
|
||||||
|
@@ -7,7 +7,7 @@ namespace Orchard.Core.Common.DataMigrations {
|
|||||||
//CREATE TABLE Common_BodyRecord (Id INTEGER not null, Text TEXT, Format TEXT, ContentItemRecord_id INTEGER, primary key (Id));
|
//CREATE TABLE Common_BodyRecord (Id INTEGER not null, Text TEXT, Format TEXT, ContentItemRecord_id INTEGER, primary key (Id));
|
||||||
SchemaBuilder.CreateTable("BodyRecord", table => table
|
SchemaBuilder.CreateTable("BodyRecord", table => table
|
||||||
.ContentPartVersionRecord()
|
.ContentPartVersionRecord()
|
||||||
.Column<string>("Text", column => column.WithLength(10000))
|
.Column<string>("Text", column => column.Unlimited())
|
||||||
.Column<string>("Format")
|
.Column<string>("Format")
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@@ -20,7 +20,7 @@ namespace Orchard.Comments.DataMigrations {
|
|||||||
.Column<string>("Email")
|
.Column<string>("Email")
|
||||||
.Column<string>("Status")
|
.Column<string>("Status")
|
||||||
.Column<DateTime>("CommentDateUtc")
|
.Column<DateTime>("CommentDateUtc")
|
||||||
.Column<string>("CommentText", column => column.WithLength(10000))
|
.Column<string>("CommentText", column => column.Unlimited())
|
||||||
.Column<int>("CommentedOn")
|
.Column<int>("CommentedOn")
|
||||||
.Column<int>("CommentedOnContainer")
|
.Column<int>("CommentedOnContainer")
|
||||||
);
|
);
|
||||||
|
@@ -67,7 +67,12 @@ namespace Orchard.DevTools.Services {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( createColumn.Length.HasValue ) {
|
if ( createColumn.Length.HasValue ) {
|
||||||
options.Add(string.Format("WithLength({0})", createColumn.Length ));
|
if ( createColumn.Length == 10000 ) {
|
||||||
|
options.Add("Unlimited()");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
options.Add(string.Format("WithLength({0})", createColumn.Length));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( createColumn.Precision > 0 ) {
|
if ( createColumn.Precision > 0 ) {
|
||||||
|
@@ -23,5 +23,14 @@ namespace Orchard.Data.Migration.Schema {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public new AlterColumnCommand WithLength(int? length) {
|
||||||
|
base.WithLength(length);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public new AlterColumnCommand Unlimited() {
|
||||||
|
return WithLength(10000);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -37,5 +37,8 @@ namespace Orchard.Data.Migration.Schema {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ColumnCommand Unlimited() {
|
||||||
|
return WithLength(10000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -64,6 +64,10 @@ namespace Orchard.Data.Migration.Schema {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public new CreateColumnCommand Unlimited() {
|
||||||
|
return WithLength(10000);
|
||||||
|
}
|
||||||
|
|
||||||
public new CreateColumnCommand WithType(DbType dbType) {
|
public new CreateColumnCommand WithType(DbType dbType) {
|
||||||
base.WithType(dbType);
|
base.WithType(dbType);
|
||||||
return this;
|
return this;
|
||||||
|
Reference in New Issue
Block a user