gobuffalo / pop

A Tasty Treat For All Your Database Needs
MIT License
1.44k stars 243 forks source link

Soda v4.6.3 Fizz Back Tick Issues #198

Closed emmercm closed 6 years ago

emmercm commented 6 years ago

Related issues:

Environment:

Ran with Travis CI with .travis.yml similar to:

language: go

services:
  - postgresql

addons:
  postgresql: "9.6"

go:
  - "1.10"

env:
  - DB_USER=postgres DB_PASSWORD=

before_install:
  - cp .netrc ~
  - chmod 600 .netrc

install:
  - go get github.com/gobuffalo/pop/...
  - go get github.com/golang/lint/golint
  - go get github.com/golang/dep/cmd/dep

  - cd $GOPATH/src/github.com/gobuffalo/pop
  - git fetch
  - git --no-pager log --max-count 5
  - cd $TRAVIS_BUILD_DIR
  - go install github.com/gobuffalo/pop/soda
  - soda --version
  - cd $GOPATH/src/github.com/gobuffalo/plush
  - git fetch
  - git --no-pager log --max-count 5
  - cd $TRAVIS_BUILD_DIR

before_script:
  - soda create -d -e test_database
  - soda migrate -d -e test_database

script:
  - dep ensure
  - go test ./... -v
  - go vet ./...
  - golint $(go list ./...)
  - go build

Only migration:

raw(`CREATE EXTENSION IF NOT EXISTS "uuid-ossp";`)

create_table("users", func(t) {
  t.Column("email", "string", {})
  t.Column("twitter_handle", "string", {"size": 50})
  t.Column("age", "integer", {"default": 0})
  t.Column("admin", "bool", {"default": false})
  t.Column("company_id", "uuid", {"default_raw": "uuid_generate_v1()"})
  t.Column("bio", "text", {"null": true})
  t.Column("joined_at", "timestamp", {})
})

raw(`
    INSERT INTO users (email, twitter_handle, joined_at, created_at, updated_at)
    VALUES ('JasonJSalgado@teleworm.us', 'Soman1994', now(), now(), now());
`)

Output:

[POP] 2018/08/07 18:31:39 CREATE TABLE "schema_migration" (
"version" VARCHAR (255) NOT NULL
);
CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version);
[POP] 2018/08/07 18:31:39 SELECT EXISTS (SELECT schema_migration.* FROM schema_migration AS schema_migration WHERE version = $1) | ["20180627164200"]
[WARN] migrations/20180627164200_back_quotes.up.fizz uses an old fizz syntax. please use
sql("CREATE EXTENSION IF NOT EXISTS "uuid-ossp";")
create_table("users") {
  t.Column("email", "string", {})
  t.Column("twitter_handle", "string", {"size": 50})
  t.Column("age", "integer", {"default": 0})
  t.Column("admin", "bool", {"default": false})
  t.Column("company_id", "uuid", {"default_raw": "uuid_generate_v1()"})
  t.Column("bio", "text", {"null": true})
  t.Column("joined_at", "timestamp", {})
}
sql("
    INSERT INTO users (email, twitter_handle, joined_at, created_at, updated_at)
    VALUES ('JasonJSalgado@teleworm.us', 'Soman1994', now(), now(), now());
")
0.0174 seconds
[POP] 2018/08/07 18:31:39 pg_dump -s --dbname=postgres://postgres:@localhost:5432/pricing_test?sslmode=disable
dumped schema for pricing_test
Error: error processing migrations/20180627164200_back_quotes.up.fizz: could not fizz the migration migrations/20180627164200_back_quotes.up.fizz: line 1: expected next token to be ), got IDENT instead
line 2: no prefix parse function for ) found
Usage:
  soda migrate [flags]
  soda migrate [command]
Aliases:
  migrate, m
Available Commands:
  down        Apply one or more of the 'down' migrations.
  reset       The equivalent of running `migrate down` and then `migrate up`
  status      Displays the status of all migrations.
  up          Apply all of the 'up' migrations.
Flags:
  -h, --help   help for migrate
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")
Use "soda migrate [command] --help" for more information about a command.
error processing migrations/20180627164200_back_quotes.up.fizz: could not fizz the migration migrations/20180627164200_back_quotes.up.fizz: line 1: expected next token to be ), got IDENT instead
line 2: no prefix parse function for ) found
stanislas-m commented 6 years ago

Should be fixed with v4.6.5.

emmercm commented 6 years ago

Can confirmed fixed, thank you so much!