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

Feature Request: "CREATE DATABASE metrics IF NOT EXISTS" #4323

Closed
leehambley opened this issue Oct 5, 2015 · 4 comments
Closed

Feature Request: "CREATE DATABASE metrics IF NOT EXISTS" #4323

leehambley opened this issue Oct 5, 2015 · 4 comments

Comments

@leehambley
Copy link

We're provisioning (in some of our environments) influxdb using Puppet, that means creating databases and users, etc. It would help a lot if we could conditionally create databases, rather than listing, grep'ing, and trying to guess if the database already exists on subsequent Puppet runs to avoid errors such as:

==> e2e: Error: /opt/influxdb/influx -execute "CREATE DATABASE metrics"
         returned 1 instead of one of [0] 
==> e2e: Error: /Stage[main]/Influxdb/Exec[/opt/influxdb/influx -execute
         "CREATE DATABASE metrics"]/returns: change from notrun to 0 failed:
         /opt/influxdb/influx -execute "CREATE DATABASE metrics" returned 1 instead of
         one of [0]
@corylanou
Copy link
Contributor

Support for this was added in 0.9.4 #3892

Syntax is:

CREATE DATABASE IF NOT EXISTS metrics

@leehambley
Copy link
Author

Thanks Cory, documentation is then out of date, thanks.
On 5 Oct 2015 1:51 pm, "Cory LaNou" notifications@github.com wrote:

Closed #4323 #4323.


Reply to this email directly or view it on GitHub
#4323 (comment).

@corylanou
Copy link
Contributor

I added a ticket to have the documentation updated as well. Thanks! https://github.com/influxdb/influxdb.com/issues/360

@gdmello
Copy link

gdmello commented Aug 15, 2017

For anyone coming here first, the syntax has changed to-
CREATE DATABASE <dbname> for version > 1.0

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

No branches or pull requests

3 participants