Skip to content
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

initdb commands for decryptor and keyper #23

Merged
merged 4 commits into from
Sep 8, 2021
Merged

Conversation

jannikluhn
Copy link
Contributor

Closes #14 and #17

The linter doesn't like it, but I think it is wrong: Rows.Close doesn't return an error. It might be confused because Rows.Close from the database/sql package does.

Return all tables except for the ones postgres creates by default.
@jannikluhn jannikluhn requested a review from a user September 7, 2021 14:39
@ghost
Copy link

ghost commented Sep 7, 2021

So, you're calling the linter a liar? That's mean.

It just asks you to change the code to:

	rows, err := dbpool.Query(ctx, dbNotEmptyQuery)
	if err != nil {
		return false, errors.Wrap(err, "failed to ask db if it is empty")
	}
	defer rows.Close()

@jannikluhn
Copy link
Contributor Author

You're right, I sincerely apologize to the linter.

@ghost
Copy link

ghost commented Sep 7, 2021

Why do we need the empty database check? That's rather unusual I'd say. Maybe 'CREATE TABLE IF NOT EXISTS..`
is what you want?

@jannikluhn
Copy link
Contributor Author

I just want to check that the db isn't already initialized and that it's not used for anything else. The former could be done with IF NOT EXISTS, but the latter can't. Would you say that's unnecessary?

@ghost
Copy link

ghost commented Sep 8, 2021

yes, that's not necessary.

You might have a look at https://github.com/golang-migrate/migrate, which is what we may end up using to manage database migrations (though that's also not necessary at the moment).

@jannikluhn jannikluhn merged commit a52f42f into main Sep 8, 2021
@jannikluhn jannikluhn deleted the jannik/init-db branch September 16, 2021 08:52
konradkonrad pushed a commit to konradkonrad/rolling-shutter that referenced this pull request Jul 19, 2023
…t-db

initdb commands for decryptor and keyper
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.

Initialize database subcommand
1 participant