protected override string MakeAlterColumnScript(ColumnInfo c, MappedPropertyAttribute prop)
        {
            var temp = prop.DefaultValue;

            prop.DefaultValue = null;
            var col = string.Format("alter table {0} alter column {1};",
                                    MakeIdentifier(c.table_schema ?? DefaultSchemaName, c.table_name),
                                    MakeColumnString(prop));

            prop.DefaultValue = temp;
            return(col);
        }
 private string MaybeMakeColumnTypeString(MappedPropertyAttribute attr, bool skipDefault = false)
 {
     if (reverseTypeMapping.ContainsKey(attr.SystemType))
     {
         var typeStr = MakeSqlTypeString(attr);
         return(string.Format("{0} {1} {2}NULL {3}",
                              attr.Name,
                              typeStr,
                              attr.IsOptional ? "" : "NOT ",
                              !skipDefault ? attr.DefaultValue ?? "" : "").Trim());
     }
     return(null);
 }
        protected override string MakeColumnString(MappedPropertyAttribute p)
        {
            var typeStr = MakeSqlTypeString(p);

            if (p.IsIdentity)
            {
                typeStr = "autoincrement";
            }
            return(string.Join(" ",
                               p.Name,
                               typeStr,
                               p.IsOptional || p.IncludeInPrimaryKey ? "" : "NOT NULL")
                   .Trim());
        }
 protected override string MakeDefaultConstraintScript(ColumnInfo c, MappedPropertyAttribute prop)
 {
     if (prop.DefaultValue == null)
     {
         return(string.Format("alter table {0} drop constraint DEF_{1}_{2}",
                              MakeIdentifier(c.table_schema ?? DefaultSchemaName, c.table_name),
                              c.table_name,
                              c.column_name));
     }
     else
     {
         return(string.Format("alter table {0} add constraint DEF_{1}_{2} default {3} for {2}",
                              MakeIdentifier(c.table_schema ?? DefaultSchemaName, c.table_name),
                              c.table_name,
                              c.column_name,
                              prop.DefaultValue));
     }
 }
        protected override string MakeColumnString(MappedPropertyAttribute p)
        {
            var typeStr       = MakeSqlTypeString(p);
            var defaultString = "";

            if (p.DefaultValue != null)
            {
                defaultString = string.Format("DEFAULT ({0})", p.DefaultValue);
            }
            else if (p.IsIdentity)
            {
                defaultString = "IDENTITY(1, 1)";
            }

            return(string.Format("{0} {1} {2} {3}",
                                 p.Name,
                                 typeStr,
                                 p.IsOptional ? "" : "NOT NULL",
                                 defaultString));
        }
Example #6
0
        protected override string MakeColumnString(MappedPropertyAttribute p)
        {
            var typeStr       = MakeSqlTypeString(p);
            var defaultString = "";

            if (p.DefaultValue != null)
            {
                defaultString = "DEFAULT " + p.DefaultValue.ToString();
            }
            else if (p.IsIdentity)
            {
                defaultString = "DEFAULT nextval('serial')";
            }

            return(string.Format("{0} {1} {2} {3}",
                                 p.Name,
                                 typeStr,
                                 p.IsOptional ? "NULL": "NOT NULL",
                                 defaultString));
        }
        public void IsIncludedByDefault1()
        {
            var p = new MappedPropertyAttribute();

            Assert.IsTrue(p.Include);
        }
Example #8
0
 protected override string MakeDefaultConstraintScript(ColumnInfo columnInfo, MappedPropertyAttribute prop)
 {
     throw new System.NotImplementedException();
 }
Example #9
0
 protected override string MakeAddColumnScript(string tableID, MappedPropertyAttribute prop)
 {
     throw new System.NotImplementedException();
 }
 protected override string MakeAddColumnScript(string tableID, MappedPropertyAttribute prop)
 {
     return(string.Format("alter table {0} add {1} {2};", tableID, prop.Name, prop.SqlType));
 }
Example #11
0
 protected override string MakeDefaultConstraintScript(ColumnInfo columnInfo, MappedPropertyAttribute prop)
 {
     throw new System.NotImplementedException();
 }
Example #12
0
 protected override string MakeAddColumnScript(string tableID, MappedPropertyAttribute prop)
 {
     throw new System.NotImplementedException();
 }
 protected override string MakeAlterColumnScript(ColumnInfo columnInfo, MappedPropertyAttribute prop)
 {
     throw new NotImplementedException();
 }
Example #14
0
 protected override string MakeColumnString(MappedPropertyAttribute p)
 {
     throw new NotImplementedException();
 }
 public void IsIncludedByDefault1()
 {
     var p = new MappedPropertyAttribute();
     Assert.IsTrue(p.Include);
 }