mirror of
https://github.com/elicpeter/nyx.git
synced 2026-06-15 20:05:13 +02:00
refactor(dynamic): introduce SQL profile for migration hardening with SQLite egress restrictions, extend framework SQL handling logic, and update test coverage across harnesses
This commit is contained in:
parent
6ee2bdda36
commit
9bf085ee48
11 changed files with 365 additions and 23 deletions
|
|
@ -5,7 +5,7 @@
|
|||
class AddUsers {
|
||||
public function up() {
|
||||
$col = getenv('NYX_PAYLOAD') ?: 'email';
|
||||
$safe = preg_replace('/[^A-Za-z0-9_]/', '_', $col);
|
||||
$safe = strtolower(preg_replace('/[^A-Za-z0-9_]/', '_', $col));
|
||||
$stmt = "ALTER TABLE users ADD COLUMN " . $safe . " TEXT";
|
||||
echo "LARAVEL_SQL: " . $stmt . "\n";
|
||||
return $stmt;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@
|
|||
const _NYX_ADAPTER_MARKER = "require('@prisma/client')";
|
||||
|
||||
async function up(name) {
|
||||
const safe = String(name || process.env.NYX_PAYLOAD || 'users').replace(/[^A-Za-z0-9_]/g, '_');
|
||||
const safe = String(name || process.env.NYX_PAYLOAD || 'users')
|
||||
.replace(/[^A-Za-z0-9_]/g, '_')
|
||||
.toLowerCase();
|
||||
const prisma = global.__nyx_prisma || { $executeRawUnsafe: async (s) => s };
|
||||
return prisma.$executeRawUnsafe('CREATE INDEX idx_' + safe + ' ON users(name)');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@
|
|||
const _NYX_ADAPTER_MARKER = "queryInterface.createTable";
|
||||
|
||||
module.exports.up = async function (queryInterface, Sequelize) {
|
||||
const name = (process.env.NYX_PAYLOAD || 'users').replace(/[^A-Za-z0-9_]/g, '_');
|
||||
const name = (process.env.NYX_PAYLOAD || 'users')
|
||||
.replace(/[^A-Za-z0-9_]/g, '_')
|
||||
.toLowerCase();
|
||||
if (queryInterface && typeof queryInterface.addColumn === 'function') {
|
||||
await queryInterface.addColumn(name, 'description', { type: 'TEXT' });
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue