how can i rerun the sql script using DbUp with new modifications?

Saleh Salem 0 Reputation points
2024-10-01T11:48:28.9266667+00:00

Hello

I am new to using DbUp and when I run a script it runs successfully but when I add some modifications I get this message

Beginning database upgrade

Checking whether journal table exists..

Fetching list of already executed scripts.

No new scripts need to be executed - completing.

Success!
ex:
now I have this code

CREATE TABLE domain.StoreAdmins(

AdminId INT,

StoreId INT,

AdminName NVARCHAR(255) NOT NULL,

AdminEmail NVARCHAR(255) NOT NULL,

AdminPhoneNumber NVARCHAR(20) NOT NULL,

PRIMARY KEY(AdminId,StoreId),

);

then I run the database

and I have changed it to be
CREATE TABLE domain.StoreAdmins(

AdminId INT,

StoreId INT,

AdminName NVARCHAR(255) NOT NULL,

AdminPhoneNumber NVARCHAR(20) NOT NULL,

PRIMARY KEY(AdminId,StoreId),

);

when I run again I got the message up

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,479 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,771 questions
{count} votes

1 answer

Sort by: Most helpful
  1. LiHongMSFT-4306 27,016 Reputation points
    2024-10-02T01:40:24.24+00:00

    Hi @Saleh Salem

    No new scripts need to be executed - completing.

    How about adding ALTER like this:

    CREATE OR ALTER TABLE domain.StoreAdmins(
    AdminId INT,
    StoreId INT,
    AdminName NVARCHAR(255) NOT NULL,
    AdminPhoneNumber NVARCHAR(20) NOT NULL,
    PRIMARY KEY(AdminId,StoreId),
    );
    

    Best regards,

    Cosmog


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.