![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
@forty-boy/sql
Advanced tools
A MySQL Library for Node.js
Currently creating this as a hobby project, but we'll see where it goes.
npm install @forty-boy/sql
OR yarn add @forty-boy/sql
const Forty = require('@forty-boy/sql')
import Forty from '@forty-boy/sql'
import { Table } from '@forty-boy/sql'
.env
file at root with values for corresponding keys in .env-example
found herenpm install
OR yarn install
.env
file at root with values for corresponding keys in .env-example
npm run dev
OR yarn run dev
userTable.find({ columns: ['id', 'createdAt'] });
For the rest of these examples we'll be using this user table
class UserSchema {
id?: number; // This is nullable for Create calls
fullName: string;
dateOfBirth: Date;
constructor(id: number, fullName: string, dateOfBirth: Date) {
this.id = id;
this.fullName = fullName;
this.dateOfBirth = dateOfBirth;
}
}
type UserDateset = Array<UserSchema>;
export class UserTable extends Table<UserSchema> {
constructor(tableName: string, users: UserDataset = []) {
super(tableName, UserSchema, users);
}
}
async createProducts(): Promise<void> {
const sql = new SqlService('products');
await sql.createTableQuery([
{
name: 'id',
type: 'INT',
size: 11,
primaryKey: true,
autoIncrement: true,
nullable: false,
},
{ name: 'name', type: 'VARCHAR', size: 255, default: 'Test Product' },
{ name: 'price', type: 'INT', size: 11 },
{ name: 'createdAt', type: 'DATETIME' },
{
name: 'createdBy',
type: 'INT',
nullable: false,
foreignKey: {
referenceId: 'id',
referenceTable: 'users',
},
},
]);
}
userTable.add({
fullName: 'Blaze Rowland',
dateOfBirth: new Date(1997, 11, 14),
});
userTable
.find({
columns: ['id', 'fullName'],
condition: { id: 1 },
})
.subscribe((users) => console.log(users));
userTable
.findOne({
columns: ['id'],
condition: {
fullName: 'Blaze Rowland',
},
})
.subscribe((user) => console.log(user));
userTable
.update({
values: { fullName: 'Rylee Brown' },
condition: { id: 1 },
})
.subscribe((res) => console.log(res));
userTable
.findOne({
columns: ['id'],
condition: {
id: 1,
},
})
.subscribe({
next: (user) =>
userTable
.update({
values: { fullName: 'Forrest Rowland' },
condition: { id: user.id },
})
.subscribe((res) => console.log(res)),
});
userTable
.findOne({
columns: ['id'],
condition: {
fullName: 'Forrest Rowland',
},
})
.subscribe({
next: (user) => {
productTable
.add({
name: 'Pacifier',
price: 5,
createdAt: new Date(),
createdBy: user.id,
})
.subscribe((res) => console.log(res));
},
});
productTable.delete({ id: 1 });
productTable
.join({
joinType: 'INNER JOIN',
columnsToSelect: [
{ column: 'name' },
{ column: 'price' },
{ column: 'fullName', as: 'userName', table: userTable.tableName },
{ column: 'dateOfBirth', table: userTable.tableName },
],
columnsOn: [
{
from: { column: 'id', table: userTable.tableName },
to: { column: 'createdBy', table: productTable.tableName },
},
],
})
.subscribe((res) => console.log(res));
productTable
.join({
joinType: 'LEFT JOIN',
columnsToSelect: [
{ column: 'name' },
{ column: 'price' },
{ column: 'fullName', as: 'userName', table: userTable.tableName },
{ column: 'dateOfBirth', table: userTable.tableName },
],
columnsOn: [
{
from: { column: 'id', table: userTable.tableName },
to: { column: 'createdBy', table: productTable.tableName },
},
],
})
.subscribe((res) => console.log(res));
productTable
.join({
joinType: 'RIGHT JOIN',
columnsToSelect: [
{ column: 'name' },
{ column: 'price' },
{ column: 'fullName', as: 'userName', table: userTable.tableName },
{ column: 'dateOfBirth', table: userTable.tableName },
],
columnsOn: [
{
from: { column: 'id', table: userTable.tableName },
to: { column: 'createdBy', table: productTable.tableName },
},
],
})
.subscribe((res) => console.log(res));
userTable
.union({
queries: [
{
columns: ['id', 'fullName'],
tableName: 'users',
},
{
columns: ['id', 'name'],
tableName: 'products',
},
],
all: true, // Changes whether Union statement is UNION (false || not provided) or UNION ALL (true)
})
.subscribe((res) => console.log(res));
Create an instance of the SQL Service
const sqlService = new SqlService('users')
Add Columns:
await sqlService.alterTableQuery({
columnsToAdd: [
{
name: 'location',
type: 'VARCHAR',
size: 255,
},
],
});
Alter Columns:
await sqlService.alterTableQuery({
columnsToAlter: [
{
name: 'firstName',
newName: 'fullName',
type: 'VARCHAR',
size: 255,
},
],
});
Remove Columns:
await sqlService.alterTableQuery({
columnsToRemove: [
{
name: 'lastName',
},
],
});
columnsToAdd
, columnsToAlter
, and columnsToRemove
can all be added to the alterAbleQuery like so:
await sqlService.alterTableQuery({
columnsToAdd: [
{
name: 'location',
type: 'VARCHAR',
size: 255,
},
],
columnsToAlter: [
{
name: 'firstName',
newName: 'fullName',
type: 'VARCHAR',
size: 255,
},
],
columnsToRemove: [
{
name: 'lastName',
},
],
});
Create an instance of the SQL Service
const sqlService = new SqlService('users')
sqlService.dropTable();
FAQs
A MySQL Library for Node.js
The npm package @forty-boy/sql receives a total of 1 weekly downloads. As such, @forty-boy/sql popularity was classified as not popular.
We found that @forty-boy/sql demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.