Prisma1: Migrations set to false results in Array field errors

Created on 13 Sep 2018  Â·  7Comments  Â·  Source: prisma/prisma1

Describe the bug
Deploying to a database with migrations: true, results in a seamless deployment. Deploying, either to an existing database with the proper tables and migrations: false, or to a database with no existing tables and migrations false results in errors regarding PostgreSQL array fields which didn't previously exist.

To Reproduce
Steps to reproduce the behavior (this assumes that there is a hidden step in which the db is populated with tables using another prisma service, so that migrations: false has a fresh db deployed with migrations: true to look at; left it out to reduce complexity):

  1. Setup docker-compose.ymlwith the following basic services:
    ```
    version: "3"
    services:

database:
image: postgres:9.6
restart: always
ports:
- "5432:5432"
networks:
- dev
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: prisma

prisma:
image: prismagraphql/prisma:1.16.0
restart: always
depends_on:
- database
networks:
- dev
ports:
- "4466:4466"
environment:
PRISMA_CONFIG: |
port: 4466
managementApiSecret: my-prisma-api-secret
databases:
default:
connector: postgres
active: true
host: database
port: 5432
user: postgres
password: prisma
migrations: false

networks:
dev:
driver: bridge

volumes:
queue-persistence:


2. Setup a model such as 

type ExampleType {
id: ID! @unique
createdAt: DateTime!
updatedAt: DateTime!
firstList: [String!]
secondList: [String!]!
}

3. Start your docker setup, and run `prisma deploy` with the proper environment variables.
4. You should see an error:

Errors:
ExampleType
✖ The scalar field firstList has the wrong format: [String!] Possible Formats: String, String!
✖ The scalar field secondList has the wrong format: [String!]! Possible Formats: String, String!
```

Expected behavior
I expect the behavior to be the same as running without migrations: false. PostgreSQL array fields should still be supported.

Versions (please complete the following information):

  • OS: OS X High Sierra 10.13.6
  • prisma CLI: prisma/1.16.0 (darwin-x64) node-v9.9.0
  • Prisma Server: 1.16.0
bu2-confirmed areengine

All 7 comments

Out of interest, why and how did you change the migrations: true to migrations: false?

Hi @marktani, I would like to have migrations: false instead of migrations: true now because I would like to use a different database versioning tool to migrate my tables (ex. FlywayDB, Liquibase). Up until now I have been using prisma, but would like more control over my migrations as well as the ability to rollback changes. That being said I did not expect different behavior regarding the schema from prisma based on that setting.

As for "how" I changed it, I made the change in the file, tore down the old docker instances and started a whole new instance of docker containers to make sure the new prisma server had the new config.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

I was also able to reproduce this issue on the latest version of the prisma and the cli:
Prisma version: 1.21.1
CLI version: 1.21.1
OS: Ubuntu 18.04

migration: false is rare use case but if we provide the option it should not crash and hence this is a bug.

Here is the terminal output:
screenshot 2018-11-29 at 5 33 39 pm

Reproduction repo: https://github.com/pantharshit00/prisma-migration-issue-repro-3095

We are working on lifting this restriction at the moment.

We are working on an improved datamodel that does not have this restriction anymore, see here: https://github.com/prisma/prisma/issues/3408

This will go into a closed beta in the next weeks.

You can find the new datamodel here: https://github.com/prisma/datamodel-v1.1-feedback

Closing

Was this page helpful?
0 / 5 - 0 ratings