pub async fn qe_setup(prisma_schema: &str) -> CoreResult<()> {
    let config = parse_configuration(prisma_schema)?;
    let features = features::from_config(&config);

    let source = config
        .datasources
        .first()
        .ok_or_else(|| CoreError::Generic(anyhow!("There is no datasource in the schema.")))?;

    let connector = match &source.active_provider {
        provider
            if [
                MYSQL_SOURCE_NAME,
                POSTGRES_SOURCE_NAME,
                SQLITE_SOURCE_NAME,
                MSSQL_SOURCE_NAME,
            ]
            .contains(&provider.as_str()) =>
        {
            // 1. creates schema & database
            SqlMigrationConnector::qe_setup(&source.url().value).await?;
            SqlMigrationConnector::new(&source.url().value, features).await?
        }
        x => unimplemented!("Connector {} is not supported yet", x),
    };

    let engine = MigrationApi::new(connector);

    // 2. create the database schema for given Prisma schema
    let schema_push_input = SchemaPushInput {
        schema: prisma_schema.to_string(),
        assume_empty: true,
        force: true,
    };

    SchemaPushCommand::execute(&schema_push_input, &engine).await?;

    Ok(())
}
/// Database setup for connector-test-kit.
Database setup for connector-test-kit.
Database setup for connector - test - kit .
pub async fn qe_setup(prisma_schema: &str) -> CoreResult<()> {
    let config = parse_configuration(prisma_schema)?;
    let features = features::from_config(&config);
    let source = config
        .datasources
        .first()
        .ok_or_else(|| CoreError::Generic(anyhow!("There is no datasource in the schema.")))?;
    let connector = match &source.active_provider {
        provider
            if [
                MYSQL_SOURCE_NAME,
                POSTGRES_SOURCE_NAME,
                SQLITE_SOURCE_NAME,
                MSSQL_SOURCE_NAME,
            ]
            .contains(&provider.as_str()) =>
        {
            // 1. creates schema & database
            SqlMigrationConnector::qe_setup(&source.url().value).await?;
            SqlMigrationConnector::new(&source.url().value, features).await?
        }
        x => unimplemented!("Connector {} is not supported yet", x),
    };
    let engine = MigrationApi::new(connector);
    // 2. create the database schema for given Prisma schema
    let schema_push_input = SchemaPushInput {
        schema: prisma_schema.to_string(),
        assume_empty: true,
        force: true,
    };
    SchemaPushCommand::execute(&schema_push_input, &engine).await?;
    Ok(())
}
pub async fn qe_setup ( prisma_schema : & str ) -> CoreResult < ( ) > { let config = parse_configuration ( prisma_schema ) ? ; let features = features :: from_config ( & config ) ; let source = config . datasources . first ( ) . ok_or_else ( | | CoreError :: Generic ( anyhow ! ( " " ) ) ) ? ; let connector = match & source . active_provider { provider if [ MYSQL_SOURCE_NAME , POSTGRES_SOURCE_NAME , SQLITE_SOURCE_NAME , MSSQL_SOURCE_NAME , ] . contains ( & provider . as_str ( ) ) => { // 1. creates schema & database SqlMigrationConnector :: qe_setup ( & source . url ( ) . value ) . await ? ; SqlMigrationConnector :: new ( & source . url ( ) . value , features ) . await ? } x => unimplemented ! ( " " x ) , } ; let engine = MigrationApi :: new ( connector ) ; // 2. create the database schema for given Prisma schema let schema_push_input = SchemaPushInput { schema : prisma_schema . to_string ( ) , assume_empty : true , force : true , } ; SchemaPushCommand :: execute ( & schema_push_input , & engine ) . await ? ; Ok ( ( ) ) }
Database setup for connector-test-kit.
Database setup for connector - test - kit .
prisma_schema
&str
prisma_schema
&str