-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Postgresql adapter #10
Conversation
{ | ||
internal static string DevConnectionString = | ||
Environment.GetEnvironmentVariable("MR_ASPNETCORE_JOBS_POSTGRESQL_CS_DEV") ?? | ||
@"Server=127.0.0.1;Port=5432;Database=MR.AspNetCore.Jobs.Dev;User Id=postgres;Password=password;"; |
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.
FYI, this overrides what you configure as your connection string in your applications service configuration, so probably should remove it.
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.
Unless I'm mistaken somehow, this is the connection string that will be used at design time while developing only (to run migrations). In your own app, this whole class should never be used. That's supposedly what IDesignTimeDbContextFactory
does. Can you explain why you think this will override that in the app?
return $@" | ||
DELETE | ||
FROM ""{schema}"".""{table}"" | ||
WHERE ExpiresAt < @now |
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.
postgres didn't like this field syntax. seems to need everything fully qualified with schema. this worked for me:
return $@"
DELETE
FROM ""{schema}"".""{table}""
WHERE ""{schema}"".""{table}"".""ExpiresAt"" < @now
AND ctid IN (
SELECT ctid
FROM ""{schema}"".""{table}""
ORDER BY ""{schema}"".""{table}"".""ExpiresAt""
LIMIT @count
)";
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.
Thanks. I have little experience with postgres, and not enough time to test things out (which is why this PR is still pending).
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.
With little simplification, I'd guess this should also work:
return $@"
DELETE
FROM ""{schema}"".""{table}""
WHERE ""ExpiresAt"" < @now
AND ctid IN (
SELECT ctid
FROM ""{schema}"".""{table}""
ORDER BY ""ExpiresAt""
LIMIT @count
)";
The problem is with the LIMIT not being accepted without using CTID, I think.
Closing for now since this is stale. No time to work on this package for now. |
Closes #2