Coder Social home page Coder Social logo

Comments (16)

mhelleborg avatar mhelleborg commented on May 16, 2024 1

@lecaillon Is this something you would accept a PR on? If so, I could prioritize implementing it against the current version

from evolve.

lecaillon avatar lecaillon commented on May 16, 2024 1

Let me release the Evolve 2.0 version.
It's a major rework of Evolve to help simplify the overall design.
When it's finish it should let me a lot more time to add new features like this one. Promess ;)

from evolve.

lecaillon avatar lecaillon commented on May 16, 2024 1

@GeirGrusom @ld0614 @jouana @modernist @CaueArua

Actively working on it for the next release: Evolve 2.1.0
Thanks to @mhelleborg for its PR that helps me a lot.

I have to implement it in Evolve, but also in Evolve.MSBuild and the CLI.
Shoudn't be too long though.

Usage

try
{
    var cnx = new SqliteConnection(Configuration.GetConnectionString("MyDatabase"));
    var evolve = new Evolve.Evolve(cnx, msg => _logger.LogInformation(msg))
    {
        Locations = new[] { "ConsoleApp1.db.migrations" },
        EmbeddedResourceContext = Assembly.GetExecutingAssembly()
    };

    evolve.Migrate();
}
catch (Exception ex)
{
    _logger.LogCritical("Database migration failed.", ex);
    throw;
}

Feel free to give me your feedback

from evolve.

mhelleborg avatar mhelleborg commented on May 16, 2024 1

@lecaillon I think I would prefer having a cleaner API, and maybe drop the functionality from the CLI. I think most of the value proposition for me is using Evolve from code, but other people might have other use cases :)

from evolve.

lecaillon avatar lecaillon commented on May 16, 2024

Hi, I don't have feedback where have files in a script folder is a problem either on Windows or Linux. More over hide the scripts in the assembly goes against the simplicity and the transparency goal of Evolve IMO.

from evolve.

GeirGrusom avatar GeirGrusom commented on May 16, 2024

My cases:

  1. Embedded resources won't get confused by application shadowing or other such monkey business (we have an application that has made it exceptionally awkward to find file relative to the application).

  2. Migrations scripts should not be altered by hand on-site, and embedded resources makes sure that doesn't happen without developer intervention.

Simply put I think it makes it easier to deploy. Also flyway supports loading migration scripts from the jar.

from evolve.

ld0614 avatar ld0614 commented on May 16, 2024

I think this is a good option and would have avoided my issues in #76

from evolve.

jouana avatar jouana commented on May 16, 2024

Hi everyboby,

It should be cool to have this feature.

We have a WPF application with SQLite, this feature should help us for many way.

Regards.

from evolve.

CaueArua avatar CaueArua commented on May 16, 2024

This feature is exencial when you build an application that will run on client. If you expose the spl you have a major security breach.
Please implement this feature.

from evolve.

modernist avatar modernist commented on May 16, 2024

+1. I totally agree this is a useful feature. @lecaillon @mhelleborg if any help is needed to move this forward towards a release let me know, it's been almost a year since the PR was opened.

from evolve.

mhelleborg avatar mhelleborg commented on May 16, 2024

@lecaillon You could improve upon my original interface with a list of assembly / locations, instead of the single EmbeddedResourceContext. I think that would be better than overloading the file locations, and would support potentially loading scripts from multiple assemblies. It also makes the interface contract less ambigous :)

from evolve.

lecaillon avatar lecaillon commented on May 16, 2024

@mhelleborg You think in this case something like ResourceFilters is more suitable than Locations ?
So you would have 2 new properties:

  • EmbeddedResourceLocations
  • EmbeddedResourceFilters

from evolve.

mhelleborg avatar mhelleborg commented on May 16, 2024

@lecaillon I was more thinking sending in a list of assemblies with a set of locations each. More or less a tuple of assembly and list of locations.

Alternatively, just let the user provide a lambda which returns an IEnumerable of migrations. Then they can be loaded from anywhere

from evolve.

lecaillon avatar lecaillon commented on May 16, 2024

@mhelleborg I need to find a structure easy to use via json or web.config/app.config files for Evolve.MSBuild, or via command line options for Evolve.CLI
So 2 lists of strings separated by ; seemed a good idea

Thus it implies you cannot filter migrations script by assembly. It is a general filter. That's why at first I thought to allow only one Assembly to avoid confusion

from evolve.

lecaillon avatar lecaillon commented on May 16, 2024

@mhelleborg I think I will going to keep the EmbeddedResourceContext to avoid confusion with the EmbeddedResourceLocations term used by file migration scripts. So:

  • Assembly[] EmbeddedResourceContexts: one or several relative or absolute pathes to assemblies to scan
  • string[] EmbeddedResourceFilters: zero or multiple filters to apply when searching for embedded migration scripts

In Evolve.MSBuild or Evolve.CLI those 2 properties will be a list of string where values will be separated by ;

Everyone's ok with that ?

from evolve.

lecaillon avatar lecaillon commented on May 16, 2024

Or...

  • EmbeddedResourceAssemblies
  • EmbeddedResourceFilters

;)

from evolve.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.