question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Conditionals control flow should flow with migrations

See original GitHub issue

Describe the bug The check {if index exists} working in reverted way.

To Reproduce The following statement:

if (Schema.Table("core_users").Index("ix_core_users_discriminator").Exists())
      Delete.Index("ix_core_users_discriminator").OnTable("core_users").OnColumn("discriminator");

throws an error: ORA-01418: specified index does not exist Sql: DROP INDEX ix_core_users_discriminator

Expected behavior It should not attempt to delete the index

Information (please complete the following information):

  • OS: Windows 10
  • Platform .NET Core 3.1.x
  • FluentMigrator version 3.2.6
  • FluentMigrator runner
  • Database Management System: Oracle
  • Database Management System Version: “Oracle 18xe”

Additional context If I revert the statement to:

if (!Schema.Table("core_users").Index("ix_core_users_discriminator").Exists())
      Delete.Index("ix_core_users_discriminator").OnTable("core_users").OnColumn("discriminator");

Then it works with no issue. See the “!”.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jzabroskicommented, Jun 5, 2020

But I can see now those exists checks need to be used carefully assuming they are executed at the beginnig of the script and that the index name must be unique across the scheme (not table like in mssql).

I did create a batch actions ticket recently to make some of this easier to use: #1221

Separately, I had a separate idea for allowing monadic-like F#-like computation expressions in FluentMigrator. See: #987 The idea is that one could use something like LINQ IEnumerable interface and the LINQ syntax to define a monadic-like computation that builds up a list of side effects (aka migrations) and then executes them. While you might not think of an existence check as being a side effect, it does require querying the “outside world” and then taking a destructive action, so it is a side effect. But, in my judgment, there are higher priority features and I don’t know if most users would understand or like the idea vs. just fixing bugs and adding more common features like tablespaces/partitions and other things.

1reaction
jzabroskicommented, Jun 5, 2020

Thanks. I probably won’t look any further today but I have a checklist of things to investigate. Ideally I’d like to include a fix (or respond with correct usage syntax) before 3.2.7 is published, which I have a hard cut-off goal of Sunday night for 3.2.7 fixes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Best Practices for Migration to Flows
Migrate to Flow Learning Map · Migrate Processes and Workflows to Flow ... Performance: Can you use Entry Conditions or other optimizations to...
Read more >
MinimumVersion X & --MaximumVersion Y --Task (Migrate ...
Is there a reason for the need to specify the whole migrate up and migrate ... Conditionals control flow should flow with migrations...
Read more >
How to analyze, plan and prioritize your Flow migrations
How to analyze, plan and prioritize your Flow migrations. A lot has been written in blogs about how to build Flows and exploit...
Read more >
Automate This! — Migrate Workflow Rules and Processes ...
Analyze existing flows to see if there are corresponding elements that you can update or incorporate new actions in an existing flow (this...
Read more >
Control Flow - SQL Server Integration Services (SSIS)
It specifies the order in which tasks and containers are executed at run time and the conditions under which tasks and containers run....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found