Skip to content
This repository has been archived by the owner on Sep 2, 2022. It is now read-only.

Commit

Permalink
prisma1 (#5060)
Browse files Browse the repository at this point in the history
Co-authored-by: timsuchanek <[email protected]>
  • Loading branch information
janpio and timsuchanek authored Jan 12, 2021
1 parent 939e487 commit f234d24
Show file tree
Hide file tree
Showing 14 changed files with 60 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Email: ${account!.login[0].email}
Name: ${account!.name}`)
} catch (e) {
this.out.log(
`Currently not logged in. Run ${chalk.cyan('prisma login')} to login.`,
`Currently not logged in. Run ${chalk.cyan('prisma1 login')} to login.`,
)
}
}
Expand Down
24 changes: 11 additions & 13 deletions cli/packages/prisma-cli-core/src/commands/deploy/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ export default class Deploy extends Command {
${chalk.green.bold('Examples:')}
${chalk.gray(
'-',
)} Deploy local changes from prisma.yml to the default service environment.
${chalk.green('$ prisma deploy')}
'-',
)} Deploy local changes from prisma.yml to the default service environment.
${chalk.green('$ prisma1 deploy')}
${chalk.gray(
'-',
)} Deploy local changes from default service file accepting potential data loss caused by schema changes
${chalk.green('$ prisma deploy --force')}
'-',
)} Deploy local changes from default service file accepting potential data loss caused by schema changes
${chalk.green('$ prisma1 deploy --force')}
`
static flags: Flags = {
force: flags.boolean({
Expand Down Expand Up @@ -135,9 +135,7 @@ ${chalk.gray(

if (cluster && cluster.local && !(await cluster.isOnline())) {
throw new Error(
`Could not connect to server at ${
cluster.baseUrl
}. Please check if your server is running.`,
`Could not connect to server at ${cluster.baseUrl}. Please check if your server is running.`,
)
}

Expand Down Expand Up @@ -189,7 +187,7 @@ ${chalk.gray(
workspace!,
noMigrate,
noGenerate,
noHook
noHook,
)
}

Expand Down Expand Up @@ -370,12 +368,12 @@ ${chalk.gray(
if (!noHook && isGenerateHookPresent) {
this.out.log(
chalk.yellow(
`Warning: The \`prisma generate\` command was executed twice. Since Prisma 1.31, the Prisma client is generated automatically after running \`prisma deploy\`. It is not necessary to generate it via a \`post-deploy\` hook any more, you can therefore remove the hook if you do not need it otherwise.`,
`Warning: The \`prisma1 generate\` command was executed twice. Since Prisma 1.31, the Prisma client is generated automatically after running \`prisma1 deploy\`. It is not necessary to generate it via a \`post-deploy\` hook any more, you can therefore remove the hook if you do not need it otherwise.`,
),
)
}
const generateCommand = new GenerateCommand({
config: this.config
config: this.config,
})
generateCommand.run()
} else {
Expand Down Expand Up @@ -481,7 +479,7 @@ ${chalk.gray(
} else {
this.out.log(
`\nIf you want to ignore the warnings, please deploy with the --force flag: ${chalk.cyan(
'$ prisma deploy --force',
'$ prisma1 deploy --force',
)}`,
)
this.out.log(
Expand Down
14 changes: 8 additions & 6 deletions cli/packages/prisma-cli-core/src/commands/export/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,19 @@ export default class Export extends Command {
if (
this.definition.definition!.databaseType &&
this.definition.definition!.databaseType === 'document'
) {
throw new Error(`Export is not yet supported for document stores. Please use the native export features of your database.
) {
throw new Error(`Export is not yet supported for document stores. Please use the native export features of your database.
More info here: https://docs.mongodb.com/manual/reference/program/mongodump/`)
} else {
this.out.log(chalk.yellow(`Warning: The \`prisma export\` command will not be further developed in the future. Please use the native export features of your database for these workflows.
} else {
this.out.log(
chalk.yellow(`Warning: The \`prisma1 export\` command will not be further developed in the future. Please use the native export features of your database for these workflows.
More info here:
MySQL: https://dev.mysql.com/doc/refman/5.7/en/mysqlimport.html
Postgres: https://www.postgresql.org/docs/10/app-pgrestore.html
`))
`),
)
}

const cluster = await this.definition.getCluster()
Expand All @@ -63,7 +65,7 @@ Postgres: https://www.postgresql.org/docs/10/app-pgrestore.html
)

const importCommand = chalk.green.bold(
`$ prisma import --data ${exportPath}`,
`$ prisma1 import --data ${exportPath}`,
)
this.out.log(`Exported service to ${chalk.bold(exportPath)}
You can import it to a new service with
Expand Down
18 changes: 7 additions & 11 deletions cli/packages/prisma-cli-core/src/commands/init/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default class Init extends Command {
try {
files = fs.readdirSync(this.config.definitionDir)
} catch (e) {
debug(`prisma init workflow called without existing directory.`)
debug(`prisma1 init workflow called without existing directory.`)
debug(e.toString())
}
// the .prismarc must be allowed for the docker version to be functioning
Expand Down Expand Up @@ -104,7 +104,7 @@ datamodel: datamodel.prisma
}

endpointSteps.push(
`Deploy your Prisma service: ${chalk.cyan('prisma deploy')}`,
`Deploy your Prisma service: ${chalk.cyan('prisma1 deploy')}`,
)

const endpointCreatedFiles = [
Expand All @@ -116,10 +116,8 @@ datamodel: datamodel.prisma

this.out.log(`
${chalk.bold(
`Created ${
endpointCreatedFiles.length
} new files: `,
)}
`Created ${endpointCreatedFiles.length} new files: `,
)}
${endpointCreatedFiles.join('\n')}
Expand Down Expand Up @@ -193,7 +191,7 @@ datamodel: datamodel.prisma${databaseTypeString}`
)
}

steps.push(`Deploy your Prisma service: ${chalk.cyan('prisma deploy')}`)
steps.push(`Deploy your Prisma service: ${chalk.cyan('prisma1 deploy')}`)

if (results.database && results.database.alreadyData) {
steps.push(
Expand Down Expand Up @@ -235,10 +233,8 @@ datamodel: datamodel.prisma${databaseTypeString}`

this.out.log(`
${chalk.bold(
`Created ${
createdFiles.length
} new files: `,
)}
`Created ${createdFiles.length} new files: `,
)}
${createdFiles.join('\n')}
Expand Down
2 changes: 1 addition & 1 deletion cli/packages/prisma-cli-core/src/commands/list/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export default class List extends Command {
if (!gotCloud) {
this.out.log('')
this.out.warn(`This does not include your services deployed in the cloud.
In order to see them, please run ${chalk.bold.green('prisma login')}`)
In order to see them, please run ${chalk.bold.green('prisma1 login')}`)
}
}
}
4 changes: 2 additions & 2 deletions cli/packages/prisma-cli-core/src/examples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const defaultDefinition: ProjectDefinition = {
# This file is the main config file for your Prisma Service.
# It's very minimal at this point and uses default values.
# We've included a hello world function here.
# Just run \`prisma deploy\` to have the first running Prisma Service.
# Just run \`prisma1 deploy\` to have the first running Prisma Service.
#
# Check out some examples:
# https://github.com/prisma/framework/tree/master/examples
Expand Down Expand Up @@ -118,7 +118,7 @@ export const changedDefaultDefinition: ProjectDefinition = {
# This file is the main config file for your Prisma Service.
# It's very minimal at this point and uses default values.
# We've included a hello world function here.
# Just uncomment it and run \`prisma deploy\`
# Just uncomment it and run \`prisma1 deploy\`
#
# Check out some examples:
# https://github.com/prisma/framework/tree/master/examples
Expand Down
12 changes: 7 additions & 5 deletions cli/packages/prisma-cli-engine/src/CLI.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ jest.unmock('fs-extra')
jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000

async function run(...argv: string[]) {
const cli = new CLI({ config: { argv: ['prisma'].concat(argv), mock: true } })
const cli = new CLI({
config: { argv: ['prisma1'].concat(argv), mock: true },
})
try {
await cli.run()
return cli
Expand Down Expand Up @@ -53,7 +55,7 @@ async function run(...argv: string[]) {
describe('edge cases', () => {
test('shows help for `help` command itself', async () => {
const cli = await run('help')
expect(cli.cmd.out.stdout.output).toMatch(/Usage: prisma COMMAND/)
expect(cli.cmd.out.stdout.output).toMatch(/Usage: prisma1 COMMAND/)
})
})

Expand Down Expand Up @@ -83,14 +85,14 @@ describe('cli help', () => {
describe('cli version', () => {
test('-v', async () => {
const cli = await run('-v')
expect(cli.cmd.out.stdout.output).toContain('prisma/')
expect(cli.cmd.out.stdout.output).toContain('/1.1')
})
test('--version', async () => {
const cli = await run('--version')
expect(cli.cmd.out.stdout.output).toContain('prisma/')
expect(cli.cmd.out.stdout.output).toContain('/1.1')
})
test('version', async () => {
const cli = await run('version')
expect(cli.cmd.out.stdout.output).toContain('prisma/')
expect(cli.cmd.out.stdout.output).toContain('/1.1')
})
})
4 changes: 2 additions & 2 deletions cli/packages/prisma-cli-engine/src/CLI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,14 +209,14 @@ export class CLI {
}
}

if (this.notifier.update) {
if (this.notifier.update && this.notifier.update.latest.startsWith('1.')) {
this.notifier.notify({
message:
'Update available ' +
chalk.dim(this.notifier.update.current) +
chalk.reset(' → ') +
chalk.cyan(this.notifier.update.latest) +
`\nRun ${chalk.bold.cyan('npm i -g prisma')} to update`,
`\nRun ${chalk.bold.cyan('npm i -g prisma1')} to update`,
boxenOpts: {
padding: 1,
margin: 1,
Expand Down
2 changes: 1 addition & 1 deletion cli/packages/prisma-cli-engine/src/Parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class Parser {
if (this.input.cmd.constructor.name === 'Export' && arg === '-E') {
throw new Error(
`-E has been renamed to -e. -e has been renamed to -p. Get more information with ${chalk.bold.green(
'prisma export -h',
'prisma1 export -h',
)}`,
)
} else {
Expand Down
26 changes: 12 additions & 14 deletions cli/packages/prisma-cli-engine/src/commands/help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export default class Help extends Command {
'https://www.prisma.io',
)})
${chalk.bold('Usage:')} ${chalk.bold('prisma')} COMMAND`)
${chalk.bold('Usage:')} ${chalk.bold('prisma1')} COMMAND`)
const topics = (ptopics || this.plugins.topics).filter(t => {
if (!t.id) {
return
Expand All @@ -128,16 +128,14 @@ ${chalk.bold('Usage:')} ${chalk.bold('prisma')} COMMAND`)
// if (t.id === 'cluster') {
// debugger
// }
return cmds
.filter(cmd => !cmd.hidden)
.map(cmd => {
const cmdName = cmd.command ? ` ${cmd.command}` : ''
const deprecation = cmd.deprecated ? ' (deprecated)' : ''
return [
t.id + cmdName,
chalk.dim((cmd.description || t.description) + deprecation),
]
})
return cmds.filter(cmd => !cmd.hidden).map(cmd => {
const cmdName = cmd.command ? ` ${cmd.command}` : ''
const deprecation = cmd.deprecated ? ' (deprecated)' : ''
return [
t.id + cmdName,
chalk.dim((cmd.description || t.description) + deprecation),
]
})
}),
)) as any
const name = group.deprecated ? `${group.name} (deprecated)` : group.name
Expand All @@ -160,17 +158,17 @@ ${chalk.bold('Usage:')} ${chalk.bold('prisma')} COMMAND`)
})

this.out.log(`\nUse ${chalk.cyan(
'prisma help [command]',
'prisma1 help [command]',
)} for more information about a command.
Docs can be found here: https://bit.ly/prisma-cli-commands
${chalk.dim('Examples:')}
${chalk.gray('-')} Initialize files for a new Prisma service
${chalk.cyan('$ prisma init')}
${chalk.cyan('$ prisma1 init')}
${chalk.gray('-')} Deploy service changes (or new service)
${chalk.cyan('$ prisma deploy')}
${chalk.cyan('$ prisma1 deploy')}
`)
}

Expand Down
2 changes: 1 addition & 1 deletion cli/packages/prisma-cli-engine/src/defaultDefinition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const defaultDefinition: ProjectDefinition = {
# This file is the main config file for your Prisma Project.
# It's very minimal at this point and uses default values.
# We've included a hello world function here.
# Just uncomment it and run \`prisma deploy\`
# Just uncomment it and run \`prisma1 deploy\`
#
# Check out some examples:
# github.com/prisma/examples
Expand Down
2 changes: 1 addition & 1 deletion cli/packages/prisma-cli-engine/src/mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const mockDefinition: ProjectDefinition = {
# This file is the main config file for your Prisma Project.
# It's very minimal at this point and uses default values.
# We've included a hello world function here.
# Just uncomment it and run \`prisma deploy\`
# Just uncomment it and run \`prisma1 deploy\`
#
# Check out some examples:
# github.com/prisma/examples
Expand Down
10 changes: 5 additions & 5 deletions cli/packages/prisma-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"version": "1.21.1",
"name": "prisma",
"name": "prisma1",
"description": "Prisma is a realtime GraphQL database layer. Connect directly from the frontend or build your own GraphQL server.",
"keywords": [
"prisma",
Expand All @@ -10,17 +10,17 @@
"api",
"server"
],
"homepage": "https://github.com/prisma/prisma",
"homepage": "https://github.com/prisma/prisma1",
"repository": {
"type": "git",
"url": "https://github.com/prisma/prisma.git"
"url": "https://github.com/prisma/prisma1.git"
},
"bugs": {
"url": "https://github.com/prisma/prisma/issues"
"url": "https://github.com/prisma/prisma1/issues"
},
"main": "dist/index.js",
"bin": {
"prisma": "dist/index.js"
"prisma1": "dist/index.js"
},
"files": [
"dist"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import testSchema from '../common'

describe('Reserved Tables', () => {
describe.skip('Reserved Tables', () => {
test('ignore relation table', async () => {
await testSchema(`CREATE TABLE \`Test\` (
\`pk\` varchar(55) NOT NULL,
Expand Down

1 comment on commit f234d24

@mrmaxnikitin
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ERROR

Please sign in to comment.