Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep yessql.db as the fallback name for sqlite #15157

Closed
wants to merge 2 commits into from

Conversation

MikeAlhayek
Copy link
Member

@MikeAlhayek
Copy link
Member Author

@hishamco note here I am using orchardcore.db as per suggestion from @sebastienros during meeting today.

@MikeAlhayek MikeAlhayek changed the title Keep yessql.db as the fallback name for sqllite Keep yessql.db as the fallback name for sqlite Jan 23, 2024
@Skrypt
Copy link
Contributor

Skrypt commented Jan 24, 2024

I will leave that one for @sebastienros to decide 😄

@hishamco
Copy link
Member

@hishamco note here I am using orchardcore.db as per suggestion from @sebastienros during meeting today.

Usually, I see the recording and then react to feedback suggestions, but you didn't mention that's the meeting suggestion feel free to close my PR

@MikeAlhayek
Copy link
Member Author

The meeting suggestion to lower case the name. This PR provides the fix I described in the issue.

@hishamco
Copy link
Member

There are a lot of changes in your PR that might not be necessary, I agree with @Skrypt that we might need some sort of logging or validation

Again while the IO check happened once I don't think it's a big issue

@MikeAlhayek
Copy link
Member Author

@hishamco can you give me an example of an unnesasry change? This PR make renaming the file seemless without any breaking change. "Breaking change that we brought to main already".

I still don't think we should be doing the IO check if we don't have to. Validation should not be needed. We also don't validate if someone changes other appsettings like site name, or database prefix... if you have access to the appsettings and make direct changes, we should assume that you know what you are doing and not add validation for that.

@Skrypt
Copy link
Contributor

Skrypt commented Jan 24, 2024

Those are all valid arguments but in the end what we want is to make things easier for ITs that don't know that these settings may have a typo. If the app fails silently then who's going to go and debug the issue? You every time or an IT guy that will more likely look at the app logs to find what the issue might be?

Now, here we are introducing a new failing point and on @hishamco PR we are doing an I/O check ... it's all about compromise here. I'm not against each of these submitted PR's so stop wasting time and leave it for @sebastienros to decide 😉

@Skrypt
Copy link
Contributor

Skrypt commented Jan 24, 2024

To be simpler. Test it, Rename the appsetting databasename and see what the app logs or not.

@hishamco
Copy link
Member

According to the documentation, this should fix the issue:

{
    "OrchardCore_Data_Sqlite": {
        "DatabaseName": "yessql.db",
        "UseConnectionPooling": false
    }
}

@MikeAlhayek
Copy link
Member Author

@Skrypt if the file is missing, yessql will throw exception. That is enough for someone to know they screwed up the appsettings. I still don't believe we should have a check. In the framework if we check for everything IT does, we'll just bog down the framework.

Perhapse, we should just undo that PR that introduced the breaking change and keep the file called yessql.db and we don't need to worry about customizing the name :)

@hishamco
Copy link
Member

I'm not sure what's the wrong with the above settings while its documented? we could close both PRs :)

@MikeAlhayek
Copy link
Member Author

@hishamco the problem is that it is a breaking change that could be avoided.

@hishamco
Copy link
Member

You can if you set the settings as I mentioned in #15157 (comment)

@Skrypt
Copy link
Contributor

Skrypt commented Jan 24, 2024

I just tried it and I get nothing in the logs. I just get a 404 page when debugging the website with VS Code. And I tried with this branch. I added "DatabaseName": "OrchardCore.db" in the appsettings.json file of my tenant and I renamed the database to OrchardCore2.db

Here is my log:

2024-01-24 13:46:05.8801|||14|Microsoft.Hosting.Lifetime|INFO|Now listening on: https://localhost:5001 
2024-01-24 13:46:05.8988|||14|Microsoft.Hosting.Lifetime|INFO|Now listening on: http://localhost:5000 
2024-01-24 13:46:05.8988||||Microsoft.Hosting.Lifetime|INFO|Application started. Press Ctrl+C to shut down. 
2024-01-24 13:46:05.8988||||Microsoft.Hosting.Lifetime|INFO|Hosting environment: Development 
2024-01-24 13:46:05.8988||||Microsoft.Hosting.Lifetime|INFO|Content root path: F:\Repositories\OrchardCore\src\OrchardCore.Cms.Web 

Don't assume, test it. 😠

@Skrypt
Copy link
Contributor

Skrypt commented Jan 24, 2024

And the worst part is that it created a new OrchardCore.db file in my tenant folder...

image

image

@MikeAlhayek
Copy link
Member Author

@Skrypt if you tested this PR, then it assumes that your file is yessql.db. If the file is called anything else then it should be in the settings file.

In the settings file you can have
{
"DatabaseName": "jasmin.db"
}

and the file should be jasmin.db. If you don't specify anything then it would be yessql.db. if you create a new site, then the file will be called orchardcore.db and the same name will be found in the settings.

@Skrypt
Copy link
Contributor

Skrypt commented Jan 24, 2024

All my point is about making a typo on that DatabaseName since the beginning. I tested the use case and I'm reporting you the issue. You said it would log ;it doesn't and it creates a new database named as what I'm adding in the appsettings.json file of my tenant instead of just throwing at the right place before creating a new database that will try to initialize a new setup. The worst part is that it doesn't even get me to the setup page. I get a 404 ... that's not good ... we can do better.

Don't want to argue more on this.

/// </summary>
public string DatabaseName { get; set; } = "OrchardCore.db";
public string DatabaseName { get; private set; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get; set;

@sebastienros
Copy link
Member

Please revert the PR that changed the database name. We'll put it back when the migration path is well-defined and the implementation is not brittle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Keep yessql.db as the fallback name for sqlite for backward compatability
4 participants