Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

cockroachdb compatibility #478

Closed
glycerine opened this issue Jun 21, 2017 · 1 comment
Closed

cockroachdb compatibility #478

glycerine opened this issue Jun 21, 2017 · 1 comment

Comments

@glycerine
Copy link

glycerine commented Jun 21, 2017

Since cockroachdb is written in Go, and speaks the postgres wire protocol, and is horizontally scalable, it would be a great match for Buffalo. When I manually created the three database (deal_development, deal_test, deal_production) in cockroach, everything worked just fine: "buffalo dev" started up just fine.

Next I ran buffalo db drop -a, and while it appeared to succeed on the command line, from the cockroachdb admin http interface, those databases still exist. So drop does not work with cockroachdb.

Transcript:

jaten@jatens-MacBook-Pro-2 ~/go/src/github.com/gobuffalo/buffalo/deal (master) $ buffalo db drop -a
v3.23.2

DROP DATABASE deal_development;
DROP DATABASE deal_test;
DROP DATABASE deal_production;
jaten@jatens-MacBook-Pro-2 ~/go/src/github.com/gobuffalo/buffalo/deal (master) $ buffalo db create -a
v3.23.2

CREATE DATABASE deal_production;
Usage:
  buffalo db create [flags]

Flags:
  -a, --all   Creates all of the databases in the database.yml

Global Flags:
  -c, --config string   The configuration file you would like to use.
  -d, --debug           Use debug/verbose mode
  -e, --env string      The environment you want to run migrations against. Will use $GO_ENV if set. (default "development")
  -p, --path string     Path to the migrations folder (default "./migrations")

Error: couldn't create database deal_production: error creating PostgreSQL database deal_production: exit status 1

jaten@jatens-MacBook-Pro-2 ~/go/src/github.com/gobuffalo/buffalo/deal (master) $ 

I thought that perhaps the create failed because the tables already existed. But no, create fails even if the tables are not there.

jaten@jatens-MacBook-Pro-2 ~/go/src/github.com/gobuffalo/buffalo/deal (master) $ cockroach sql --insecure
# Welcome to the cockroach SQL interface.
# All statements must be terminated by a semicolon.
# To exit: CTRL + D.
^[[Jroot@:26257/> drop database deal_development;
^[[Jroot@:26257/> drop database deal_development;
DROP DATABASE
^[[Jroot@:26257/> drop database deal_test;
^[[Jroot@:26257/> drop database deal_test;
DROP DATABASE
^[[Jroot@:26257/> drop database deal_production;
^[[Jroot@:26257/> drop database deal_production;
DROP DATABASE
^[[Jroot@:26257/> ^D
^[[Jjaten@jatens-MacBook-Pro-2 ~/go/src/github.com/gobuffalo/buffalo/deal (master) $ buffalo db create -a
v3.23.2

CREATE DATABASE deal_development;
Usage:
  buffalo db create [flags]

Flags:
  -a, --all   Creates all of the databases in the database.yml

Global Flags:
  -c, --config string   The configuration file you would like to use.
  -d, --debug           Use debug/verbose mode
  -e, --env string      The environment you want to run migrations against. Will use $GO_ENV if set. (default "development")
  -p, --path string     Path to the migrations folder (default "./migrations")

Error: couldn't create database deal_development: error creating PostgreSQL database deal_development: exit status 1
$

Are there any logs about what went wrong? The error message here isn't very informative.


In any case, it would be great to be able to use cockroachdb with buffalo.

Since it is a Go program, cockroach is a single all-in-one binary, and it is very easy to get started with:

https://www.cockroachlabs.com/docs/install-cockroachdb.html

@markbates
Copy link
Member

I've moved this issue to https://github.com/markbates/pop/issues/82

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants