Use Symfony 4.4.23 without a Database, Symfony update is causing issues with this - symfony

I have an old Symfony website which is using the framework bundle but no database is required for the content. This works fine till 4.4.18 but upgrading to the latest version is giving the following error:
An exception occurred in driver: could not find driver
I haven't modified DATABASE_URL in .env or configured the driver in config/packages/doctrine.yaml. Is there anyway I can simple disable the use of database?

Thanks to the comment from #cerad, removing doctrine-migrations package from composer.json helped with the issue.
As I am not using a Database for the site, this is fine for me.

if your app doesn't use the database the best course of action is to remove the doctrine/doctrine-bundle and/or symfony/orm-pack (if you've installed the orm support via pack)
if that's not an option than set the DATABASE_URL= to nothing (like that, not the empty string), or if you've hit some bug in dbal dsn parsing give it the dummy sqlite until the issue gets resolved DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"

Related

Is mariadb-java-client 2.2.3 compatible with MySQL 8.0?

I'm using mariadb-java-client 2.2.3 to connect to a MySQL server 8.0.11. I'm also using spring-boot 2.0.2. for the application.
On application startup, I'm getting the following execption:
java.sql.SQLException: (conn=9) Unknown system variable 'tx_isolation'
at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.get(ExceptionMapper.java:198) ~[mariadb-java-client-2.2.3.jar:na]
at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.getException(ExceptionMapper.java:110) ~[mariadb-java-client-2.2.3.jar:na]
at org.mariadb.jdbc.MariaDbStatement.executeExceptionEpilogue(MariaDbStatement.java:228) ~[mariadb-java-client-2.2.3.jar:na]
at org.mariadb.jdbc.MariaDbStatement.executeInternal(MariaDbStatement.java:334) ~[mariadb-java-client-2.2.3.jar:na]
at org.mariadb.jdbc.MariaDbStatement.executeQuery(MariaDbStatement.java:505) ~[mariadb-java-client-2.2.3.jar:na]
at org.mariadb.jdbc.MariaDbConnection.getTransactionIsolation(MariaDbConnection.java:859) ~[mariadb-java-client-2.2.3.jar:na]
According to the MySQL link below, the system variable 'tx_isolation' that was previously deprecated has now been removed. 'transaction_isolation' should be used instead.
https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-3.html
Is there a workaround for this issue?
Thanks.
There is no workaround for the moment. Issue has been created on https://jira.mariadb.org/browse/CONJ-604 to handle that for next version 2.2.5.
Currently, MySQL 8.0 is not supported (some tests even freeze the server), so waiting version to be more stable (and a working docker image to test properly with CI).
For people who switch from MySql to MariaDb on their existing SpringBoot project, and face the same issue:
Upgrading mariadb-java-client to 2.6.0+, in your pom.xml solve the issue (most tutorial on the net has 2.1).

EntityFramework 7 - CodeFirst - SQLite - Manage DB using ApplyMigrations at runtime

I am well on my way to utilizing EF7 CodeFirst with SQLite...but really want to employ DB Migrations at runtime. This is a desktop application (Click-once deployment) meant to sync with a main database when connection is available, and provide offline data when no connection is present.
I have pulled down the nuget pre-release versions and all is working, except I cannot find any documentation of how to apply the migrations at runtime. I can successfully Add-Migrations and manually Apply-Migrations...but need a way to programatically Apply-Migrations at runtime.
I've also browsed the EF7 open-source project, but could not get anywhere there.
Versions I'm using: Latest Pre-release as of 9/15/2015
EntityFramework.Sqlite v7.0.0-beta7
EntityFramework.Relational v7.0.0-beta7
EntityFramework.Commands v7.0.0-beta7
...et al...you get the picture.
I am asking for help to apply runtime migrations...or what is the documented/recommended path for programatically maintaining a local/embedded db using EF7 CodeFirst SQLite?
UPDATE:
I went back to EF6 with SQLite but then found out that there is not SQLMigrationGenerator for SQLite.
EDIT:
I believe ApplyMigrations() method referenced in one of the notes has been deprecated. Searching the repository, there is no reference to "ApplyMigrations".
Today you can invoke the extension method Migrate on the DatabaseFacade.
This method is only available when the using Microsoft.Data.Entity statement is present. It comes from the RelationalDatabaseFacadeExtensions class that is part of the EntityFramework.Relational package.
Still have to find out how to migrate up and down from the API.

Why does Flyway's Validate ignore missing files?

I use Flyway's migrate when I start my application to, well, migrate the database. As per default validateOnMigrate is enabled and validate reports an error if a already applied file is changed.
So far so good, but it seems to ignore cases where an already applied file is missing.
Secondly, if the schema contains a migration that is newer than the latest available, migrate logs a warning but doesn't fail either, for example:
Schema xxx has a version (1.1.1) that is newer than the latest
available migration (1.0.1) !
Is there a way to prevent this behaviour? I would like to have options like failIfMigrationIsMissing and failIfSchemaIsNewer.
All of this would be useful to make sure nobody installs or starts an older version on top of a newer database, e.g. downgrades. Actually I thought this would be the default behaviour, or do I miss something here?
Here's a scheme that works with flyway 4.0.3. You can check all the migrations if your versioning is more complex.
flyway.migrate();
MigrationInfoService migrationInfoService = flyway.info();
MigrationInfo[] applied = migrationInfoService.applied();
MigrationInfo last = applied[applied.length - 1];
if (MigrationState.FUTURE_SUCCESS.equals(last.getState())) {
throw new Exception("Database downgrade detected.");
}

Installing sfGuard without changing db

I am to integrate sfGuard plugin with existing application. What I want to do is to keep as much code as possible untouched. Any guides? It'd be perfect if I can use actual database schema, or bind it somehow to be used by sfGuard. I know about setting userProfile class but I'm not sure how should I get to it, not to destroy my app.
Greetings
Just install plugin. And try make migrations. doctrine::generate-migrations-diff
php symfony doctrine:generate-migrations-diff
And migrate php symfony doctrine:migrate :
php symfony doctrine:migrate
Check out question: Rebuild model without loss data in MySQL for Symfony

Active Record and Linq T4 Templates problem

I've started a C# web application project using subsonic 3.0.3 as my DAL and SQLite for database.
It doesn't have any problem when using SimpleRepo, but the problem occurs when I try to use ActiveRecord/Linq T4 templates.
It says "Metadata file 'System.Data.SQLite' could not be found". The settings.ttinclude is the one provided with SQLite.ttinclude file and its config looks ok, and other files are instructed to use SQLite.ttinclude of course. I've also tested them with an SQL Server database and everything goes fine.
Also tried searching about it on the net and all I could find were these:
Subsonic Google Groups which instructs me to add a reference to System.Data.SQLite to the top of settings.ttinclude. No luck.
Someone at here commented about this issue, and it was answered to check the connection string, which doesn't seem to be my problem, because the app works when I use SimpleRepo.
Is SQLite installed on your machine? You need the .NET driver for it as well (that's what can't be found).

Resources