question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Sequence migrations fails after updating from 2.1.0 to 2.1.2

See original GitHub issue

After upgrading from 2.1.0 to 2.1.2 migrations started failing when deployed to servers using 9.x.

Looking at the logs of migrations I see

CREATE SEQUENCE "AspNetUserClaims_Id_seq" AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE NO CYCLE;

Npgsql.PostgresException (0x80004005): 42601: syntax error at or near "AS"

Looks like the code checking version considers null as a valid “at least” version always and if not set using the new SetPostgresVersion setting it fails with 9.x.

bool VersionAtLeast(int major, int minor)
            => _postgresVersion is null || new Version(major, minor) <= _postgresVersion;

I was able to fix the issue but wanted to report the bug as it breaks existing code.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
austindrenskicommented, Oct 27, 2018

The design of the compatibility checks is intended to assume the most recent version of PostgreSQL unless otherwise specified, which is why null always passes.

It looks like the docs have a note about supporting the new IDENTITY columns, but not warning about needing to specify an explicit version to opt out of those changes.

I can update the docs to include a breaking change warning for 2.1 and 2.2.

Related

#607 #611 #612 #639

0reactions
diegomgarciacommented, Dec 26, 2018

Hi guys I’ve upgraded and this stills doesn’t work fully as expected, I’m using different contexts with different schemas, só as I’ve noted when generating on a different schema it doesn’t put the schema on the OWNED BY part of the SQL giving the follow error when trying to update:

Failed executing DbCommand (9ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
ALTER TABLE model.services ALTER COLUMN number SET DEFAULT (nextval('services_number_seq'));
ALTER SEQUENCE services_number_seq OWNED BY services.number;

Npgsql.PostgresException (0x80004005): 42P01: relation "services" does not exist

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to create migrations after upgrading to ASP.NET ...
After upgrading to ASP.NET Core 2.0, I can't seem to create migrations anymore. I'm getting. "An error occurred while calling method ' ...
Read more >
Migrate from ASP.NET Core 2.1 to 2.2
This article outlines the prerequisites and most common steps for migrating an ASP.NET Core 2.1 project to ASP.NET Core 2.2.
Read more >
Upgrade, Migration, and Patching Issues for Oracle Identity ...
This chapter describes issues associated with the upgrade and migration process of Oracle Identity and Access Management 11g Release 2 (11.1.2.1.0).
Read more >
How To Upgrade ASP.NET Core 2.1 To ASP.NET Core 3.1 ...
NET Core application and need to upgrade it, this write-up will help you. The very first step for migration is changing the target...
Read more >
Upgrading Airflow™ to a newer version - Apache Airflow
Upgrade preparation - make a backup of DB​​ This can for example be caused by a broken network connection between your CLI and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found