SimplCommerce icon indicating copy to clipboard operation
SimplCommerce copied to clipboard

Switch to PostgreSQL as a default database

Open bugproof opened this issue 4 years ago • 9 comments

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

bugproof avatar Dec 17 '19 10:12 bugproof

I'm in favor of your proposal.

fhebel avatar Jan 13 '20 09:01 fhebel

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

hishamco avatar Jan 15 '20 01:01 hishamco

@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

bugproof avatar Jan 15 '20 09:01 bugproof

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.

Leonardo-Ferreira avatar Mar 13 '20 21:03 Leonardo-Ferreira

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.

jducobu avatar Mar 20 '20 18:03 jducobu

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

ienaboard avatar Dec 16 '20 09:12 ienaboard

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

fhebel avatar Dec 16 '20 09:12 fhebel

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

Thank you.

ienaboard avatar Dec 16 '20 09:12 ienaboard

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...

Leonardo-Ferreira avatar Dec 16 '20 19:12 Leonardo-Ferreira