CREATE TABLE <%= table_name %> (
  Id int IDENTITY(1,1) NOT NULL,
  CONSTRAINT PK_<%= table_name %>_ID PRIMARY KEY CLUSTERED (Id),
  <% fields.each do |field| %>
    <% if field.key?("relationship") && field["relationship"] == true  %>
      <%= field["name"].camelize + "Id"  + " int,"  %>
      CONSTRAINT <%= table_name + "_" +  field["name"] %> FOREIGN KEY (<%= field["name"].camelize + "Id" %>)
        REFERENCES <%= field["name"] %> (Id)
          ON DELETE NO ACTION
          ON UPDATE NO ACTION,
    <% else %>
      <%= field["name"] + " " + field["type"] + "," %>
    <% end %>
  <% end %>

  CreatedAt DateTime,
  UpdatedAt DateTime
);
