Skip to content

Conversation

@simukka
Copy link
Contributor

@simukka simukka commented Dec 3, 2025

Adds PostgreSQL support to sqlcode so that it can work with both mssql and pgsql simultaneously.

@simukka simukka requested a review from starsheriff December 3, 2025 20:52
@simukka simukka marked this pull request as ready for review December 9, 2025 20:28
@simukka simukka self-assigned this Dec 9, 2025
}

preprocessed, err := sqlcode.Preprocess(d.CodeBase, schemasuffix)
preprocessed, err := sqlcode.Preprocess(d.CodeBase, schemasuffix, &mssql.Driver{})
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: The cli module is not yet compatible with postgres.

QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row
Conn(ctx context.Context) (*sql.Conn, error)
BeginTx(ctx context.Context, txOptions *sql.TxOptions) (*sql.Tx, error)
Driver() driver.Driver
Copy link
Contributor Author

@simukka simukka Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a required interface for sql.DB and shouldn't be too much of a hassle to support in internal libraries.

dbops.go Outdated
"context"
"database/sql"

mssql "github.com/denisenkom/go-mssqldb"
Copy link
Contributor Author

@simukka simukka Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: Should we use the official mssql driver?

}

if _, ok := driver.(*mssql.Driver); ok {
// TODO
Copy link
Contributor Author

@simukka simukka Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Add back the mssql sql to lock on upload.

@simukka simukka marked this pull request as draft December 17, 2025 08:15
) into schema_exists;

if not schema_exists then
raise exception 'schema "%" not found', schemaname;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit of a philosophical question, but does one need to rise an exception when attempting to delete a non existent thing? IMHO the answer is no

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants