Welcome to Upgrade DB
Upgrade DB is a powerful tool designed to help developers manage and enhance their database systems efficiently. This guide will introduce you to the myriad of APIs provided by Upgrade DB and show you how to use them to streamline your database operations.
API Overview
Here we dive into various APIs offered by Upgrade DB.
Create Database
Initialize a new database.
upgradeDB.createDatabase('myDatabase');
Drop Database
Remove a database from the system.
upgradeDB.dropDatabase('myDatabase');
Create Table
Create a new table within your database.
upgradeDB.createTable('myDatabase', 'myTable', {
id: 'INTEGER PRIMARY KEY',
name: 'TEXT NOT NULL',
age: 'INTEGER'
});
Drop Table
Remove an existing table from your database.
upgradeDB.dropTable('myDatabase', 'myTable');
Insert Record
Add a new record to a table.
upgradeDB.insertRecord('myDatabase', 'myTable', {
id: 1,
name: 'John Doe',
age: 30
});
Update Record
Update an existing record in a table.
upgradeDB.updateRecord('myDatabase', 'myTable', 1, {
age: 31
});
Delete Record
Delete a record from a table.
upgradeDB.deleteRecord('myDatabase', 'myTable', 1);
Fetch All Records
Retrieve all records from a table.
upgradeDB.fetchAllRecords('myDatabase', 'myTable');
API Integration Example
Below is an example application utilizing the Upgrade DB APIs.
// Initialize database and table
upgradeDB.createDatabase('appDB');
upgradeDB.createTable('appDB', 'users', {
id: 'INTEGER PRIMARY KEY',
name: 'TEXT NOT NULL',
age: 'INTEGER'
});
// Insert new user
upgradeDB.insertRecord('appDB', 'users', { id: 1, name: 'Alice', age: 25 });
// Update user's information
upgradeDB.updateRecord('appDB', 'users', 1, { age: 26 });
// Fetch all users
const users = upgradeDB.fetchAllRecords('appDB', 'users');
console.log(users);
// Delete user
upgradeDB.deleteRecord('appDB', 'users', 1);
// Drop table and database
upgradeDB.dropTable('appDB', 'users');
upgradeDB.dropDatabase('appDB');
With these APIs, you can manage your database effortlessly and focus on building your application.
Hash: 11dc13cdc7e2255a0c05f6fb0e817cc914d34373d6ba89e24b2c895df3544ac7