-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Conflicts: # Signum.Engine/Engine/SchemaGenerator.cs # Signum.Engine/Engine/SchemaSynchronizer.cs # Signum.Engine/Engine/SqlBuilder.cs # Signum.Engine/Linq/ExpressionVisitor/QueryFormatter.cs # Signum.React/Signum.React.csproj
- Loading branch information
Showing
93 changed files
with
5,799 additions
and
1,823 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
2895528
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PostgreSQL support is here! 🎉 🎈 ⭐️
After 10 years of Front-end changes (WPF -> ASP.Net MVC -> React and Typescript) and Back-end changes (C# 3.0 and .Net Framework 3.0 -> C# 8.0, .NEt Core 3.1) it's time to change the only think that has stayed stable: Microsoft SQL Server.
No worries! ...more than a change is a new option. Microsoft SQL Server continues being fully supported and there is no plans to keep it in maintenance mode, but it will need to make place to his new little brother, the open-source and completely free PostgreSQL!
Why PostgreSQL?
Signum Framework was born in a world where .Net was not open-source, there was no cloud, and Microsoft SQL Server was the default option for .Net developers. During all this years there have been a small but stable flow of request from users coming from the 'free world' asking for cheaper alternatives (@avifatal, @aengin, @KonstantinLukaschenko), like the very popular LAMP stack (Linux, PHP, Apache and MySQL).
Now Microsoft is the biggest open-source contributor in GitGub and .Net Core works on Docker over Linux, so the two worlds are converging... but SQL Server is expensive, closed source and has bad performance in Linux.
Hopefully by adding PostgreSQL to the mix, Signum Framework applications will be installed in environments that where before not considered a target market. Also... did I mention is completely gratis?
Moreover, PostgresSQL is quite powerful. It has an alternative to many of the exotic features of SQL Server, either out of-the-box or using some extension:
Some features are more solid in Sql Server:
While others, look more powerful in PostgreeSQL
One Framework, two DBMS
For now, no extensibility model has been built in
Signum.Engine
to allow other DBMSs (Oracle, MySql, MariaDB...) to be developed (i.e. Referencing a DBMS-specific Project), insteadSignum.Engine
now depends to bothSystem.Data.SqlClient
(.Net driver for Microsoft SQL Server) andNpgsql
(.Net driver for PostgreSQL) and reuses most of the code (Save, LINQ Provider, etc) with conditional logic when needed. You can useSchema.Current.Settings.IsPostgrees
orConnector.Current is PostgreSqlConnector
to check if the application is using a PostgresSQL.The reason for this, is that building an abstraction always has a cost, and there are just to many places in
Signum.Engine
where the conditional behavior is need. Some important differences from PostgreSQL:'MyTable'
), and are automatically lower-cased when not quoted. In SQL Server names are always case insensitive, and only special charactes or keywords need to be quoted ([MyTable]
).pg_catalog.class
) are completely different in SQL Server (sys.table
).;
between statements is mandatory, in SQL not.INTO
being mandatory afterINSERT
.But all this small differences are hidden inside of
Signum.Engine
, very few changes (if any) will surface to your code.Another reason to skip the extesibility model is to avoid the Lowest Common Denominator problem that will occur if less capable DBMS will be supported. Fortunately the intersection of features between SQL Server and PostgreSQL is quite big.
What works right now?
All the LINQ provider tests work on both SQL Server and PostgreSQL, including:
Also the Schema Synchronizer/Sql Migrations has been tested for the common cases, some rough edges are to be expected for more complex schema changes.
Only some functionality depending on SqlDependency, like Processes, still needs to be checked, and a in order to use
TreeEntity
some conditional logic usingltree
will be needed.Other than that, no PostgreSQL-specific bugs are known by me at this time, create database, run c# migration, run application, looks like everything works OK.
How to start using it?
Again, there are very few changes needed in your code to start using Postgres:
SqlDbTypeAttribute
byDbTypeAttribute
(now withSqlDbType
andNpgsqlDbType
properties), if you have any. This needs to be done whether you want to use PostgreSQL or not.Data Source=.\\SQLEXPRESS;Initial Catalog=Southwind;Integrated Security=true
to something like:
host=localhost;Username=postgres;Password=yourPassword;Database=Southwind
To avoid committing the password you can use .Net Core UserSecrets feature.
SqlConnector
byPostgreSqlConnector
andSqlServerVersionDetector
byPostgresVersionDetector
. Or make it dependent on the connection string like Southwind does.That's it! Now you can create database, synchronize, generate environment, etc.. like we have been doing for 10 years!
2895528
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Outstanding!
2895528
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work, Olmo!
2895528
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2895528
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Congratulations Olmo!
This is a tremendous major improvement on Signum, that could boost its ecosystem.
Thanks to your great and valuable efforts.
Congratulations everyone! :)
2895528
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some things when migrating:
SqlConnector
is renamed toSqlServerConnector
ObjectName
/SchemaName
/DatabaseName
constructors require a isPostgres parameter, you can take it fromSchema.Current.Settings.IsPostgres
dbo.Alert
that was namedIX_Name
not is namedIX_Alert_Name
, expect a big Sync script.