Skip to content

Commit

Permalink
Add medium and long text types
Browse files Browse the repository at this point in the history
  • Loading branch information
elpete committed Sep 22, 2017
1 parent 6403d3f commit 35b7d83
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
8 changes: 8 additions & 0 deletions models/Grammars/Grammar.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,14 @@ component displayname="Grammar" accessors="true" {
return "TEXT";
}

function typeLongText( column ) {
return "TEXT";
}

function typeMediumText( column ) {
return "TEXT";
}

function typeString( column ) {
return "VARCHAR(#column.getLength()#)";
}
Expand Down
10 changes: 10 additions & 0 deletions models/Schema/Blueprint.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,16 @@ component accessors="true" {
return addColumn( argumentCollection = arguments );
}

function longText( name ) {
arguments.type = "longText";
return addColumn( argumentCollection = arguments );
}

function mediumText( name ) {
arguments.type = "mediumText";
return addColumn( argumentCollection = arguments );
}

function tinyInteger( name, length = "" ) {
arguments.type = "tinyInteger";
return addColumn( argumentCollection = arguments );
Expand Down
16 changes: 12 additions & 4 deletions tests/specs/Schema/SchemaBuilder+GrammarSpec.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,12 @@ component extends="testbox.system.BaseSpec" {
expect( blueprint.toSql() ).toBeWithCase( "CREATE TABLE ""users"" (""personalizations"" TEXT NOT NULL)" );
} );

xit( "longText", function() {
fail( "test not implemented yet" );
it( "longText", function() {
var schema = getBuilder();
var blueprint = schema.create( "posts", function( table ) {
table.longText( "body" );
}, false );
expect( blueprint.toSql() ).toBeWithCase( "CREATE TABLE ""posts"" (""body"" TEXT NOT NULL)" );
} );

xit( "mediumIncrements", function() {
Expand All @@ -230,8 +234,12 @@ component extends="testbox.system.BaseSpec" {
fail( "test not implemented yet" );
} );

xit( "mediumText", function() {
fail( "test not implemented yet" );
it( "mediumText", function() {
var schema = getBuilder();
var blueprint = schema.create( "posts", function( table ) {
table.mediumText( "body" );
}, false );
expect( blueprint.toSql() ).toBeWithCase( "CREATE TABLE ""posts"" (""body"" TEXT NOT NULL)" );
} );

xit( "morphs", function() {
Expand Down

0 comments on commit 35b7d83

Please sign in to comment.