Skip to content

Migrations: Data motion APIs #5642

Closed as not planned
Closed as not planned

Description

@ansydor

There is nothing that can help to manipulate with data with migrations:
basically it can be implemented like
migrationBuilder.Sql("Insert ...");
but would be grate to implement it like:
migrationBuilder.Insert.IntoTable("Users").Row(new { FirstName = "John", LastName = "Smith" });

there is a case why really need it this way:
there is a table Posts with string content column, but if I want a table Contents, so i want to add a table, select data, insert data and then delete column

Activity

  1. divega commented on Jun 7, 2016

    @divega
    Contributor

    @bricelam in triage we discusses that this was probably a dupe of an existing issue to support data motion functionality. Can you please help me find that issue? 😄

  2. bricelam commented on Jun 7, 2016

    @bricelam
    Contributor

    Well, there's Work Item 16 on EF6 😏 Looks like it never made it to our EF Core backlog. We'll use this issue.

  3. changed the title [-]Initialize data via migrations[/-] [+]Migrations: Data motion APIs[/+] on Jun 7, 2016
  4. added this to the Backlog milestone on Jun 7, 2016
  5. bricelam commented on Jun 7, 2016

    @bricelam
    Contributor

    In addition to inserting, updating, and deleting data. This issue also covers transferring or moving data between tables and columns.

  6. grahamehorner commented on Oct 31, 2017

    @grahamehorner

    please consider sharding/partitioning data

  7. bricelam commented on Apr 25, 2018

    @bricelam
    Contributor

    Note, in version 2.0.0, we added InsertData(), UpdateData(), and DeleteData() migration operations.

  8. ajcvickers commented on Oct 26, 2022

    @ajcvickers
    Contributor

    Note from triage: Migrations code cannot reference application types since changes in those types will break existing migrations. This means there is little value in any API here over just writing SQL directly using migrationBuilder.Sql("...").

  9. removed this from the Backlog milestone on Oct 26, 2022
  10. pmoleri commented on Jul 28, 2025

    @pmoleri

    Note from triage: Migrations code cannot reference application types since changes in those types will break existing migrations. This means there is little value in any API here over just writing SQL directly using migrationBuilder.Sql("...").

    I think it still adds quite some value.
    E.g.

    So, it helps with the correctness of the migration scripts and portability to different DBs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions