simplcommerce / SimplCommerce

A simple, cross platform, modulith ecommerce system built on .NET
http://www.simplcommerce.com
Apache License 2.0
4.15k stars 1.57k forks source link

Switch to PostgreSQL as a default database #855

Open bugproof opened 4 years ago

bugproof commented 4 years ago

It has a less restrictive license and you can use it completely for free, unlike SQL Server.

It suits more to open-source projects and it has a great JSON support too (better than mariadb/mysql). The community is also much more active

I can open a PR if you agree

fhebel commented 4 years ago

I'm in favor of your proposal.

hishamco commented 4 years ago

Perhaps SQLite is the best choice, it's file-based, simple & lightweight for demo

bugproof commented 4 years ago

@hishamco SQLite is fine but I don't think I would use it for e-commerce. And people are usually interested in using the shop in production. PostgreSQL has a much more active community and is easier to scale. There must be a reason Microsoft acquired Citus Data

Leonardo-Ferreira commented 4 years ago

How are we on this? here's my 2 cents: it really doesn't matter which is the default database, as long as it is simple/easy to switch. Azure Sql Database is a very attractive offering, both in terms of features as scalability, so I think people will choose it.

jducobu commented 4 years ago

I investigate already on it using docker composer. The problem is for the search (cs). If you search computer and th name of the category is Computer that not match and return no result.

ienaboard commented 3 years ago

Sorry for my trivial question ... But I can't understand how to switch to another database. I would like to use MySql due to my previous experience and skills, but I really can't understan where should I change the data provider. Is there any "how to" somewhere? Thank you

fhebel commented 3 years ago

Hi @ienaboard,

there is little documentation about this topic: https://docs.simplcommerce.com/developer-guide/working-with-databases.html

I would suggest to have a look at the Dockerfile

sed -i 's#<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.0" />#<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="3.1.0" />#' src/SimplCommerce.WebHost/SimplCommerce.WebHost.csproj

sed -i 's/UseSqlServer/UseNpgsql/' src/SimplCommerce.WebHost/Program.cs

sed -i 's/UseSqlServer/UseNpgsql/' src/SimplCommerce.WebHost/Extensions/ServiceCollectionExtensions.cs

This is basically the manual what to do in order to use PostgreSQL.

From there it should not be a big deal to configure SimplCommerce for use with MySQL ...

Best regards,

Florian

ienaboard commented 3 years ago

Shame on me. I didn't see the "developer guide" link ...

Thank you.

Leonardo-Ferreira commented 3 years ago

I investigate already on it using docker composer. The problem is for the search (cs). If you search computer and th name of the category is Computer that not match and return no result.

it looks like you're talking about a Collation issue @jducobu... although CaseSensite-AccentSensitive is the default behavior for sql server (and azure sql database) this is a configuration point. You can set this at the query level, column level, table and database!

But, if your talking about fuzzy-search (users enter "coputer" and "computer" is returned), then no, SQL Database doesn't have that...