Prisma – Backup System

// start

Hi everyone!
GitHub of the Project

Use this module to create a backup measure for your project that uses Prisma. You can either backup the information, or use them to migrate to another database, or just to reset the database.
Example: Le…


This content originally appeared on DEV Community and was authored by Michael Willian Santos

// start

Hi everyone!
GitHub of the Project

Use this module to create a backup measure for your project that uses Prisma. You can either backup the information, or use them to migrate to another database, or just to reset the database.
Example: Let's say that you need to change a unique key (email) to another like (code). You can backup first,
then change the schema.prisma, and use this module to inject the old information.

// How To Use

Basic example using the Prisma, let's imagine that we have two models, User & Post. And the Post model is related to the User model.

import { PrismaClient } from '@prisma/client';
import { backup } from '@vorlefan/prisma-backup';

const prisma = new PrismaClient();

void (async function () {
    const [user, post] = await prisma.$transaction([prisma.user.findMany({}), prisma.post.findMany({})]);

    // w/out encrypt

    await backup({
        models: {
            user,
        },
    });

    // encrypting the models

    await backup({
        models: {
            user,
        },
        encrypt: true,
        password: 'pwd123',
        backupFolderName: 'encrypted'
    });
})();
// End

There a lot of feature that I'm planning for this module, then if you want to, please contribute or follow up the news xD


This content originally appeared on DEV Community and was authored by Michael Willian Santos


Print Share Comment Cite Upload Translate Updates
APA

Michael Willian Santos | Sciencx (2022-02-05T18:30:28+00:00) Prisma – Backup System. Retrieved from https://www.scien.cx/2022/02/05/prisma-backup-system/

MLA
" » Prisma – Backup System." Michael Willian Santos | Sciencx - Saturday February 5, 2022, https://www.scien.cx/2022/02/05/prisma-backup-system/
HARVARD
Michael Willian Santos | Sciencx Saturday February 5, 2022 » Prisma – Backup System., viewed ,<https://www.scien.cx/2022/02/05/prisma-backup-system/>
VANCOUVER
Michael Willian Santos | Sciencx - » Prisma – Backup System. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/02/05/prisma-backup-system/
CHICAGO
" » Prisma – Backup System." Michael Willian Santos | Sciencx - Accessed . https://www.scien.cx/2022/02/05/prisma-backup-system/
IEEE
" » Prisma – Backup System." Michael Willian Santos | Sciencx [Online]. Available: https://www.scien.cx/2022/02/05/prisma-backup-system/. [Accessed: ]
rf:citation
» Prisma – Backup System | Michael Willian Santos | Sciencx | https://www.scien.cx/2022/02/05/prisma-backup-system/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.