Modernizing Legacy Systems with Amplication's DB Schema Import

Yuval Hazaz
Yuval Hazaz
Aug 17, 2023
Modernizing Legacy Systems with Amplication's DB Schema ImportModernizing Legacy Systems with Amplication's DB Schema Import

Modernizing legacy systems isn’t just about catching up with the latest and greatest tech; it’s about staying competitive. Yet, transitioning away from legacy systems can be daunting, especially with the risk of losing valuable data or facing compatibility issues. The effort involved in setting up numerous data models, crafting Data Transfer Objects (DTOs), and coding boilerplate for hundreds of existing tables, not to mention managing intricate relations, can be massive and time-consuming. This is where our latest feature - DB Schema Import - steps in, offering an efficient and seamless way to bring your old infrastructure into the modern era without getting lost in the complexities.

Why modernize with Amplication?

Rapid Development

Launch your projects faster. Amplication’s auto-generation tools drastically cut down the development process by handling boilerplate and infrastructure code, saving you months that you'd otherwise spend crafting code for your existing data models.

Consistency

No more patchwork solutions. Amplication ensures your backend services are consistent, scalable, and up to industry standards.

Stay in Control

While Amplication streamlines the development process, you retain full ownership and control of your code. It's automation with autonomy.

Cost Savings

By reducing manual work, the risk of errors and associated costs decrease.

Efficient Data Integration with the DB Schema Import

Transitioning away from legacy systems doesn’t mean starting from scratch. With the DB Schema Import feature, you can effortlessly bring in your existing database schema, preserving the value of your legacy data and laying the foundation for new, modern applications.

Automate and standardize
backend development.
Get a demo

Getting started with DB Schema Import

Ready to upgrade your legacy system? Here's a quick guide:

  • Generate your Prisma schema: Use Prisma's introspection to scan your legacy database and produce a schema.prisma file.
  • Upload to Amplication: Once your schema is ready, bring it into Amplication, which will automatically set up your entities, fields, and relations.
  • Pick your Database: Select either MySQL or PostgreSQL by installing the appropriate DB plugin.
  • Build & Commit: Generate and commit the code for your project via Amplication.

Check out our step-by-step guide for a deeper dive

A Real-Life Example

Let's dive into an example to demonstrate just how effortless it is to create a fully-functional service using this feature. In this walkthrough, we'll leverage a Prisma Schema file to automate the setup of entities, fields, and relations, laying the groundwork for a fully functioning application to manage events.

  • Create a new ‘Event Management’ service with Amplication
    • Make sure to select MySQL or PostgreSQL database during the service creation wizard

  • After the service is created, click the “Create entities for my service” option

  • Within the entities page, click the “Upload Prisma Schema” button


datasource db {
  provider = "postgresql"
  url      = env("DB_URL")
}

generator client {
  provider = "prisma-client-js"
}

model Event {
    id          String      @id @default(uuid())
    name        String
    description String
    startDate   DateTime
    endDate     DateTime
    location    String
    attendees   Attendee[]
    sessions    Session[]
}

model Attendee {
    id          String      @id @default(uuid())
    name        String
    email       String     @unique
    eventId     String
    tikets      Ticket[]
    event       Event       @relation(fields: [eventId], references: [id])
}

model Ticket {
    id          String      @id @default(uuid())
    attendeeId  String
    ticketType  TicketType
    attendee    Attendee    @relation(fields: [attendeeId], references: [id])
}

model Session {
    id          String      @id @default(uuid())
    name        String
    speaker     String
    time        DateTime
    eventId     String
    event       Event       @relation(fields: [eventId], references: [id])
}

enum TicketType {
    FREE
    PAID
}
  • Watch the log as all the entities are imported.

  • Once the import is completed, click the entities tab to view all the newly created entities.

  • Switch to the ERD view to see a full picture of all the created entities with their fields and relations.

  • Make any additional configurations or changes, and when you are ready, build and commit the code to your Git repo.

  • Open the newly created PR to view the generated code for your Event Management service.

💡 Check out this Git repository showcasing the outcome of generating code with Amplication based on the example Prisma schema file

Gratitude to Our Beta Testers

A big thank you to the beta testers of this feature. Your invaluable feedback was instrumental in refining the DB Schema Import capability, making it more robust and developer-friendly.

In Conclusion

The challenge of updating old systems is significant, especially without losing data or running into issues. However, with Amplication's Database Schema Import, the process is simplified. This tool makes it easier to move from old systems to new ones without the typical headaches. Amplication offers an easy yet sophisticated solution to complex and time-consuming challenges as you look to modernize.

About Amplication

Amplication helps increase velocity and consistency for backend teams. It accelerates the development of microservices and backend applications using auto-generation of all the boilerplate and infrastructure code and allows developers to focus their efforts on developing the core business processes and logic. Using an extensive plugin system, developers and platform teams can automate the generation of services while keeping all the best practices and know-how of the organization.

Try it now

You can start using Amplication by simply visiting https://app.amplication.com/