https://www.prisma.io/ logo
Join Slack
Powered by
# prisma-migrate
  • i

    Iradukunda Irenee

    12/07/2021, 3:56 PM
    hello team i'm trying to create table in postgres db using prisma as ORM BY
    npx prisma db push
    but i'm getting this error .any help?
    l
    • 2
    • 2
  • i

    Iradukunda Irenee

    12/07/2021, 8:42 PM
    hello team also i have the other problem i'm my app but i'm getting this error
    Error:
    Invalid
    prisma.post.findMany()
    invocation:
    Can't reach database server at `ec2-3-229-127-203.compute-1.amazonaws.com`:`5432` Please make sure your database server is running at `ec2-3-229-127-203.compute-1.amazonaws.com`:`5432`.
  • i

    Iradukunda Irenee

    12/07/2021, 8:42 PM
    any help
  • i

    Iradukunda Irenee

    12/08/2021, 11:33 AM
    hello @here any help for this
    p
    • 2
    • 3
  • a

    Athir Nuaimi

    12/11/2021, 6:00 PM
    Hi, I’m getting an error when I try and seed my db with a nested create. It works if I only add one row in the nested table. But if try and pass an array of rows, it fails. details in the thread
    m
    • 2
    • 16
  • g

    Garrett Tolbert

    12/15/2021, 2:37 PM
    Hey all, the issue I'm having with Prisma is that I'm prototyping new schemas with "db push" but when I try to run "Prisma Migrate dev", it gives the error "Error: P3005 The database schema for
    127.0.0.1:3309
    is not empty. Read more about how to baseline an existing production database: https://pris.ly/d/migrate-baseline". I'm really not sure how to fix it so my database has my schema changes. I hope this gives better insight into the challenges I'm having.
    f
    • 2
    • 7
  • c

    Chris Bitoy

    12/20/2021, 3:05 PM
    Hey y’all, I tried to make a POST request to write into my db, but getting an error that I don’t know how to resolve:
    Copy code
    //Error:
    // 71   const template = await prisma.template.create({
    //   data: {
    //     objective: {
    //       create: undefined
    //     },
    //     creative: {
    //       create: {
    // +       brandName: String,
    // +       brandLogo: String,
    // +       headerImage: String,
    // ?       creative_format?: String,
    // +       projectName: String,
    // +       creativeUrl: String,
    // +       thumbnailUrl: String,
    // ?       minimum_secs?: Int,
    // ?       owner_id?: String,
    // ?       campaign_id?: String,
    // ?       parent_c_id?: String,
    // ?       createdAt?: DateTime,
    // ?       updatedAt?: DateTime,
    // ?       Campaign?: {
    // ?         create?: CampaignCreateWithoutCreativeInput | CampaignUncheckedCreateWithoutCreativeInput,
    // ?         connectOrCreate?: CampaignCreateOrConnectWithoutCreativeInput,
    // ?         connect?: CampaignWhereUniqueInput
    // ?       }
    //       }
    //     }
    //   },
    //   include: {
    //     objective: true,
    //     creative: true
    //   }
    // })
    
    // Argument brandLogo for data.creative.create.brandLogo is missing.
    // Argument brandName for data.creative.create.brandName is missing.
    // Argument projectName for data.creative.create.projectName is missing.
    // Argument headerImage for data.creative.create.headerImage is missing.
    // Argument creativeUrl for data.creative.create.creativeUrl is missing.
    // Argument thumbnailUrl for data.creative.create.thumbnailUrl is missing.
    
    // Note: Lines with + are required, lines with ? are optional.
    I don’t want to flood this channel with copy/paste All the codes, but please find the
    schema model, routes, and test data
    here on Codesandbox: https://codesandbox.io/s/crimson-pine-ipdd5?file=/src/schema.prisma
    n
    • 2
    • 3
  • m

    Muhad B K

    12/21/2021, 6:16 AM
    Any idea ?
  • c

    Chris Bitoy

    12/22/2021, 4:23 PM
    if I use this command
    npx prisma db pull --force
    - do I run a risk of dropping all tables in my db? What I am trying to do is pull all the tables from my production db to my local machine
    h
    • 2
    • 1
  • m

    Mischa

    12/28/2021, 7:06 AM
    I found the best thing for running migrations when using an RDS/Aurora DB in a VPC: https://docs.serverless-stack.com/constructs/Script
    👍 1
  • m

    Mischa

    12/28/2021, 7:06 AM
    run your migration lambda automatically whenever your CF stack is updated
  • m

    Mischa

    12/28/2021, 7:06 AM
    works great
  • c

    Chris Bitoy

    12/30/2021, 4:17 AM
    Hello all and happy holiday, Just ready up on Prisma data proxy, and was wondering if I can set it up in my node/express app or to avoid connection pooling or it only works on apps built on nextJS and such?
    n
    • 2
    • 1
  • h

    Hyo

    01/10/2022, 5:41 AM
    Hello~! May I know how to get Prisma
    DMMF
    type in Rust or should I rewrite this again in Rust side?
    Copy code
    export declare namespace DMMF {
        interface Document {
            datamodel: Datamodel;
            schema: Schema;
            mappings: Mappings;
        }
        interface Mappings {
            modelOperations: ModelMapping[];
            otherOperations: {
                read: string[];
                write: string[];
            };
        }
        interface OtherOperationMappings {
            read: string[];
            write: string[];
        }
        interface DatamodelEnum {
            name: string;
            values: EnumValue[];
            dbName?: string | null;
            documentation?: string;
        }
        interface SchemaEnum {
            name: string;
            values: string[];
        }
        interface EnumValue {
            name: string;
            dbName: string | null;
        }
        interface Datamodel {
            models: Model[];
            enums: DatamodelEnum[];
        }
        interface uniqueIndex {
            name: string;
            fields: string[];
        }
        interface PrimaryKey {
            name: string | null;
            fields: string[];
        }
        interface Model {
            name: string;
            dbName: string | null;
            fields: Field[];
            fieldMap?: Record<string, Field>;
            uniqueFields: string[][];
            uniqueIndexes: uniqueIndex[];
            documentation?: string;
            primaryKey: PrimaryKey | null;
            [key: string]: any;
        }
        type FieldKind = 'scalar' | 'object' | 'enum' | 'unsupported';
        type FieldNamespace = 'model' | 'prisma';
        type FieldLocation = 'scalar' | 'inputObjectTypes' | 'outputObjectTypes' | 'enumTypes';
        interface Field {
            kind: FieldKind;
            name: string;
            isRequired: boolean;
            isList: boolean;
            isUnique: boolean;
            isId: boolean;
            type: string | DMMF.SchemaEnum | DMMF.OutputType | DMMF.SchemaArg;
            dbNames?: string[] | null;
            isGenerated: boolean;
            hasDefaultValue: boolean;
            default?: FieldDefault | string | boolean | number;
            relationToFields?: any[];
            relationOnDelete?: string;
            relationName?: string;
            documentation?: string;
            [key: string]: any;
        }
        interface FieldDefault {
            name: string;
            args: any[];
        }
        interface Schema {
            rootQueryType?: string;
            rootMutationType?: string;
            inputObjectTypes: {
                model?: InputType[];
                prisma: InputType[];
            };
            outputObjectTypes: {
                model: OutputType[];
                prisma: OutputType[];
            };
            enumTypes: {
                model?: SchemaEnum[];
                prisma: SchemaEnum[];
            };
        }
        interface Query {
            name: string;
            args: SchemaArg[];
            output: QueryOutput;
        }
        interface QueryOutput {
            name: string;
            isRequired: boolean;
            isList: boolean;
        }
        type ArgType = string | InputType | SchemaEnum;
        interface SchemaArgInputType {
            isList: boolean;
            type: ArgType;
            location: FieldLocation;
            namespace?: FieldNamespace;
        }
        interface SchemaArg {
            name: string;
            comment?: string;
            isNullable: boolean;
            isRequired: boolean;
            inputTypes: SchemaArgInputType[];
            deprecation?: Deprecation;
        }
        interface OutputType {
            name: string;
            fields: SchemaField[];
            fieldMap?: Record<string, SchemaField>;
        }
        interface SchemaField {
            name: string;
            isNullable?: boolean;
            outputType: {
                type: string | OutputType | SchemaEnum;
                isList: boolean;
                location: FieldLocation;
                namespace?: FieldNamespace;
            };
            args: SchemaArg[];
            deprecation?: Deprecation;
            documentation?: string;
        }
        interface Deprecation {
            sinceVersion: string;
            reason: string;
            plannedRemovalVersion?: string;
        }
        interface InputType {
            name: string;
            constraints: {
                maxNumFields: number | null;
                minNumFields: number | null;
            };
            fields: SchemaArg[];
            fieldMap?: Record<string, SchemaArg>;
        }
        interface ModelMapping {
            model: string;
            plural: string;
            findUnique?: string | null;
            findFirst?: string | null;
            findMany?: string | null;
            create?: string | null;
            createMany?: string | null;
            update?: string | null;
            updateMany?: string | null;
            upsert?: string | null;
            delete?: string | null;
            deleteMany?: string | null;
            aggregate?: string | null;
            groupBy?: string | null;
            count?: string | null;
        }
        enum ModelAction {
            findUnique = "findUnique",
            findFirst = "findFirst",
            findMany = "findMany",
            create = "create",
            createMany = "createMany",
            update = "update",
            updateMany = "updateMany",
            upsert = "upsert",
            delete = "delete",
            deleteMany = "deleteMany",
            groupBy = "groupBy",
            count = "count",
            aggregate = "aggregate"
        }
    }
    • 1
    • 2
  • d

    do4gr

    01/10/2022, 3:43 PM
    We've updated our proposal for new migrate commands. It would be great if you could have a look and give us some feedback! https://github.com/prisma/prisma/issues/10561
    t
    • 2
    • 6
  • y

    Yaakov

    01/10/2022, 4:07 PM
    When deploying, should I only run
    prisma migrate deploy
    or must I also run
    prisma generate
    ?
  • b

    Barnaby

    01/26/2022, 1:35 PM
    Is there any way to show what the type changed from and to? Because according to my schema and DB, the types are the exact same
    Copy code
    Altered column `slug` (type changed)
  • b

    Barnaby

    01/26/2022, 1:44 PM
    quite a few fields are doing this, I had a field that someone accidentally changed directly to nullable, but when I add
    ?
    to the type, the error during migrate
    changed from Required to Nullable
    still appears so I think that's a bug
    f
    • 2
    • 1
  • k

    Ken

    02/03/2022, 3:14 AM
    Dis you resolve this issue?
  • m

    Manthan Mallikarjun

    01/30/2022, 5:02 AM
    Hello, when running
    db seed
    locally to my production database, it finishes in about 5-10 seconds. When I run it on Github Actions with pretty much the exact same settings it takes almost 50+ seconds. It must be some sort of connection stuff, or maybe lower number of cores, or poor connection, but is there any way i can start to debug it?
    t
    • 2
    • 3
  • o

    Oleg Yarin

    01/30/2022, 3:16 PM
    Hi Dear prisma team, I wanted to ask you about creating migrations with primary behaviour of persisting the data in db instead of dropping it. I see you have an issue opened about it here. However it has only 4 thumbs up. So I am wondering why so few people are interested in this? To me this looks quite important 🙂
    m
    t
    • 3
    • 3
  • f

    Frederik

    02/02/2022, 2:00 PM
    Dear Prisma Migrate Devs 👋 Just so no one misses this, in
    3.9.0
    we shipped
    migrate diff
    in preview which is a bit like a swiss army knife for migrations. The tool allows you to diff • Prisma schemas • your migration history and • database schemas in any combination and returns a script or a human readable representation of the diff. As a companion we added
    db execute
    which can be used to send the resulting script to a database. We believe this is a game changer troubleshooting all sorts of migration use cases. But please take a look and let us know what you think 🙏 Some documentation can be found here and we are working on more!
    👍 2
    t
    • 2
    • 1
  • t

    Tyler Bell

    02/08/2022, 2:10 PM
    Hey, Prisma prisma rainbow Do you all have a recommended way of “renaming” ENUM fields for a non-empty DB? Say I have this schema.
    Copy code
    model Plan {
      id                  String                 @id @default(cuid())
      createdAt           DateTime               @default(now())
      updatedAt           DateTime?              @updatedAt
      name                String
      description         String?
      status              PlanStatus             @default(DRAFT)
    }
    
    enum PlanStatus {
      LIVE
      DRAFT
    }
    and I want to change it to….
    Copy code
    model Plan {
      id                  String                 @id @default(cuid())
      createdAt           DateTime               @default(now())
      updatedAt           DateTime?              @updatedAt
      name                String
      description         String?
      status              PlanStatus             @default(ACTIVE)
    }
    
    enum PlanStatus {
      ACTIVE
      INACTIVE
    }
    Essentially I want to change
    LIVE
    ->
    ACTIVE
    and
    DRAFT
    ->
    INACTIVE
    At the moment my current plan is to… 1. add ACTIVE and INACTIVE to the PlanStatus enum such that I would have.
    Copy code
    enum PlanStatus {
      ACTIVE
      INACTIVE
      LIVE
      DRAFT
    }
    2. migrate DB 3. run a script that would update all LIVE values to ACTIVE and all DRAFT values to INACTIVE 4. remove LIVE and DRAFT from my schema
    Copy code
    enum PlanStatus {
      ACTIVE
      INACTIVE
    }
    5. migrate again I’m hoping there is a cleaner way to achieve is 🙂 Thanks!
    t
    • 2
    • 8
  • c

    Carlos Gomez

    02/10/2022, 11:58 PM
    Is there anything like
    strong_migrations
    for Prisma? https://github.com/ankane/strong_migrations
  • m

    Mushfau Saeed

    02/16/2022, 4:24 PM
    hello folks, i'm getting this error... what could be the issue?
    Copy code
    $ prisma migrate down --experimental
    Error: The current command "down" doesn't exist in the new version of Prisma Migrate.
    Copy code
    $ prisma -v
    Environment variables loaded from .env
    prisma                  : 3.9.2
    @prisma/client          : 3.9.2
    Current platform        : windows
    Query Engine (Node-API) : libquery-engine bcc2ff906db47790ee902e7bbc76d7ffb1893009 (at ..\..\node_modules\@prisma\engines\query_engine-windows.dll.node)
    Migration Engine        : migration-engine-cli bcc2ff906db47790ee902e7bbc76d7ffb1893009 (at ..\..\node_modules\@prisma\engines\migration-engine-windows.exe)
    Introspection Engine    : introspection-core bcc2ff906db47790ee902e7bbc76d7ffb1893009 (at ..\..\node_modules\@prisma\engines\introspection-engine-windows.exe)
    Format Binary           : prisma-fmt bcc2ff906db47790ee902e7bbc76d7ffb1893009 (at ..\..\node_modules\@prisma\engines\prisma-fmt-windows.exe)
    Default Engines Hash    : bcc2ff906db47790ee902e7bbc76d7ffb1893009
    Studio                  : 0.457.0
    m
    n
    • 3
    • 2
  • k

    Kiran

    02/28/2022, 1:58 PM
    Hey Folks, I am trying to deploy my prisma application in DigitalOcean but I am getting error when migration script is run. This is the error. I can run migrate in my local no problem.
    j
    f
    j
    • 4
    • 13
  • k

    Kiran

    02/28/2022, 1:58 PM
    But getting problem while running in production .
  • k

    Kiran

    03/01/2022, 3:30 PM
    Copy code
    Error: P3014
    
    Prisma Migrate could not create the shadow database. Please make sure the database user has permission to create databases. Read more about the shadow database (and workarounds) at <https://pris.ly/d/migrate-shadow>
    
    Original error: 
    db error: ERROR: permission denied to create database
       0: sql_migration_connector::flavour::postgres::sql_schema_from_migration_history
                 at migration-engine/connectors/sql-migration-connector/src/flavour/postgres.rs:363
       1: migration_core::state::DevDiagnostic
                 at migration-engine/core/src/state.rs:178
    How can I solve this bug? Any hint is much appreciated
    n
    • 2
    • 2
  • k

    Kiran

    03/01/2022, 3:33 PM
    I am trying to deploy my application in Digital Ocean app platform.
  • m

    Meyer BTS

    03/07/2022, 11:10 PM
    Hello, I’m going to put prisma in production for the first time and I don’t really understand how migrations work even though I’ve seen all the documentation available on prisma.io Someone would be available to explain and answer my questions about migration in general and more specifically about deployment? Thanks to all
    t
    n
    • 3
    • 3
1...56789Latest