shesha-io / shesha-framework

An open-source Low-Code development framework for .NET developers. Create .NET based business applications with 80% less code.
https://shesha.io
Apache License 2.0
376 stars 74 forks source link

Migration fails to complete, relation "frwk_configurationitems" does not exist #1319

Open moalamri opened 7 months ago

moalamri commented 7 months ago

Describe the bug The migration process fails due to missing relation.

To Reproduce Steps to reproduce the behavior:

  1. Set database type as PostgreSql, set the connection string.
  2. Run the application
  3. See error

Desktop (please complete the following information):

Additional context The complete migration error.

-------------------------------------------------------------------------------
20230115092299: M20230115092299 migrating
-------------------------------------------------------------------------------
Beginning Transaction
ExecuteSqlStatement delete from
        Frwk_ConfigurationItems
where
        ItemType = 'setting-configuration'
        and not exists (select 1 from Frwk_SettingConfigurations where Id = Frwk_ConfigurationItems.Id)
!!! An error occured executing the following sql:
delete from
        Frwk_ConfigurationItems
where
        ItemType = 'setting-configuration'
        and not exists (select 1 from Frwk_SettingConfigurations where Id = Frwk_ConfigurationItems.Id)
The error was 42P01: relation "frwk_configurationitems" does not exist

POSITION: 16

!!! +- 42P01: relation "frwk_configurationitems" does not exist

POSITION: 16
Rolling back transaction
Application startup exception: System.Exception: An error occured executing the following sql:
delete from
        Frwk_ConfigurationItems
where
        ItemType = 'setting-configuration'
        and not exists (select 1 from Frwk_SettingConfigurations where Id = Frwk_ConfigurationItems.Id)
The error was 42P01: relation "frwk_configurationitems" does not exist

POSITION: 16

 ---> Npgsql.PostgresException (0x80004005): 42P01: relation "frwk_configurationitems" does not exist

Before the error occurs, the following migrations are run without errors

-------------------------------------------------------------------------------
VersionMigration migrating
-------------------------------------------------------------------------------
Beginning Transaction
CreateTable VersionInfo
Committing Transaction
VersionMigration migrated
-------------------------------------------------------------------------------
VersionUniqueMigration migrating
-------------------------------------------------------------------------------
Beginning Transaction
CreateIndex VersionInfo (Version)
AlterTable VersionInfo
CreateColumn VersionInfo AppliedOn DateTime
Committing Transaction
VersionUniqueMigration migrated
-------------------------------------------------------------------------------
VersionDescriptionMigration migrating
-------------------------------------------------------------------------------
Beginning Transaction
AlterTable VersionInfo
CreateColumn VersionInfo Description citext
Committing Transaction
VersionDescriptionMigration migrated

The reason could be at the execution order?

ihouvet commented 7 months ago

Hi @moalamri - Thanks for trying Shesha out and providing feedback. We will look into it and @OmolemoBlessingLethuloe will respond on Monday.

ktsapo commented 7 months ago

Hi @moalamri I've confirmed the bug. Now working on a fix