Exemplo n.º 1
0
        public void Edit()
        {
            var vdv = new VariantDef(m_file);
            var ed  = new VariantDefTransformsEditor(m_file);

            ed.ShowContent();
        }
Exemplo n.º 2
0
        public void GetAlterSql(ISqlDumper dmp)
        {
            VersionDef current = Version;
            VersionDef prev    = Version.GetVersion(-1);

            var vardef = new VariantDef(VariantFile);
            DatabaseStructure curstruct  = current.LoadStructure(vardef);
            DatabaseStructure prevstruct = prev.LoadStructure(vardef);
            ISqlDialect       dialect    = curstruct.Dialect ?? Version.Db.Dialect;

            DbDiffOptions opts = new DbDiffOptions();

            //if (prev != null) dmp.TargetDb = new DbDefSource(DatabaseStructure.Load(prev.GetFile()), DbDefSource.ReadOnly.Flag);
            opts.AllowRecreateTable = true;
            if (prevstruct == null)
            {
                dmp.CreateDatabaseObjects(curstruct);
            }
            else
            {
                dmp.AlterDatabase(prevstruct, curstruct, opts, new Plugin.dbmodel.DbDefSource(prevstruct, Plugin.dbmodel.DbDefSource.ReadOnly.Flag), null);
            }

            current.SetVersionSql(dmp);
        }
Exemplo n.º 3
0
        public DatabaseStructure LoadStructure()
        {
            var dbs = DatabaseStructure.Load(Version.GetFile());
            var mod = new VariantDef(VariantFile);

            mod.RunTransform(dbs);
            return(dbs);
        }
Exemplo n.º 4
0
        public static DatabaseStructure LoadStructure(this VersionDef verdef, VariantDef vardef)
        {
            if (verdef == null)
            {
                return(null);
            }
            var model = DatabaseStructure.Load(verdef.GetFile());

            vardef.RunTransform(model);
            return(model);
        }
Exemplo n.º 5
0
 public override bool Create(ITreeNode parent, string name)
 {
     if (name != null)
     {
         try
         {
             var vdv   = new VariantDef();
             var mfile = new InMemoryFile("tmp.vdv");
             vdv.Save(mfile);
             parent.CreateChildTextFile(name + ".vdv", mfile.GetText());
             return(true);
         }
         catch (Exception e)
         {
             Errors.Report(e);
         }
     }
     return(false);
 }
Exemplo n.º 6
0
 public VariantDefTransformsEditor(IVirtualFile file)
     : base(DbModelTransformAddonType.Instance)
 {
     m_file = file;
     m_vdef = new VariantDef(m_file);
 }