--- /dev/null
+package SQL::Translator::Generator::DDL::SQLServer;
+
+use Moo;
+use SQL::Translator::Generator::Utils;
+
+with 'SQL::Translator::Generator::Role::DDL';
+
+sub _build_shim { SQL::Translator::Generator::Utils->new( quote_chars => [qw( [ ] )] ) }
+
+sub _build_type_map {
+ +{
+ date => 'datetime',
+ 'time' => 'datetime',
+ }
+}
+
+has sizeless_types => (
+ is => 'ro',
+ builder => '_build_sizeless_types',
+);
+
+sub _build_sizeless_types {
+ +{ map { $_ => 1 }
+ qw( tinyint smallint int integer bigint text bit image datetime ) }
+}
+
+sub field {
+ my ($self, $field) = @_;
+
+ return join ' ', $self->field_name($field), ($self->field_type($field)||die 'type is required'),
+ $self->field_autoinc($field),
+ $self->field_nullable($field),
+ $self->field_default($field),
+}
+
+sub field_type_size {
+ my ($self, $field) = @_;
+
+ ($field->size && !$self->sizeless_types->{$field->data_type}
+ ? '(' . $field->size . ')'
+ : ''
+ )
+}
+
+sub field_autoinc { ( $_[1]->is_auto_increment ? 'IDENTITY' : () ) }
+
+1;
+
--- /dev/null
+package SQL::Translator::Generator::Role::DDL;
+
+use Moo::Role;
+
+requires '_build_shim';
+requires '_build_type_map';
+requires 'field_type_size';
+
+has shim => (
+ is => 'ro',
+ builder => '_build_shim',
+);
+
+has type_map => (
+ is => 'ro',
+ builder => '_build_type_map',
+);
+
+# would also be handy to have a required size set if there is such a thing
+
+sub field_name { $_[0]->shim->quote($_[1]->name) }
+
+sub field_nullable { ($_[1]->is_nullable ? 'NULL' : 'NOT NULL' ) }
+
+sub field_default {
+ (defined $_[1]->default_value ? 'DEFAULT ' . q(') . $_[1]->default_value . q(') : () )
+}
+
+sub field_type {
+ my ($self, $field) = @_;
+
+ my $field_type = $field->data_type;
+ ($self->type_map->{$field_type} || $field_type).$self->field_type_size($field)
+}
+
+1;
--- /dev/null
+use strict;
+use warnings;
+
+use Test::More;
+
+use SQL::Translator::Generator::DDL::SQLServer;
+use SQL::Translator::Schema::Field;
+
+my $shim = SQL::Translator::Generator::DDL::SQLServer->new();
+
+is $shim->field(SQL::Translator::Schema::Field->new(
+ name => 'lol',
+ data_type => 'int',
+)), '[lol] int NULL', 'simple field is generated correctly';
+
+is $shim->field(SQL::Translator::Schema::Field->new(
+ name => 'nice',
+ data_type => 'varchar',
+ size => 10,
+)), '[nice] varchar(10) NULL', 'sized field is generated correctly';
+
+done_testing;
+