Exemplo n.º 1
0
        protected override DatAdmin.Constraint MigrateConstraintOrIndex(DatAdmin.Constraint cnt, IMigrationProfile profile, IProgressInfo progress)
        {
            var index = cnt as IndexConstraint;

            if (index != null)
            {
                foreach (var colname in index.Columns)
                {
                    var col = cnt.Table.Columns[colname.ColumnName];
                    if (col.DataType is DbTypeBlob || col.DataType is DbTypeText || col.DataType is DbTypeXml)
                    {
                        progress.Warning("Column {0}:{1} cannot be indexable, because it is BLOB type", colname, col.DataType);
                        return(null);
                    }
                }
            }
            return(base.MigrateConstraintOrIndex(cnt, profile, progress));
        }
Exemplo n.º 2
0
        public override void MigrateTable(TableStructure table, IMigrationProfile profile, IProgressInfo progress)
        {
            base.MigrateTable(table, profile, progress);

            MigrateTool.RemoveNonPk1AutoIncrements(table, progress);

            foreach (ColumnStructure col in table.Columns)
            {
                var    spec    = col.DefaultValue as SpecialConstantSqlExpression;
                string subtype = col.DataType.GetSpecificAttribute("mysql", "subtype");
                if (spec != null)
                {
                    if (subtype != "timestamp")
                    {
                        col.DefaultValue = null;
                        col.IsNullable   = true;
                        progress.Warning(String.Format("Default value for column {0}.{1} was removed, it is not valid on MySQL", table.FullName, col.ColumnName));
                    }
                }
            }
        }