Files
dss/server/migrations/20251209000002-add-config-audit-log.js
Digital Production Factory 276ed71f31 Initial commit: Clean DSS implementation
Migrated from design-system-swarm with fresh git history.
Old project history preserved in /home/overbits/apps/design-system-swarm

Core components:
- MCP Server (Python FastAPI with mcp 1.23.1)
- Claude Plugin (agents, commands, skills, strategies, hooks, core)
- DSS Backend (dss-mvp1 - token translation, Figma sync)
- Admin UI (Node.js/React)
- Server (Node.js/Express)
- Storybook integration (dss-mvp1/.storybook)

Self-contained configuration:
- All paths relative or use DSS_BASE_PATH=/home/overbits/dss
- PYTHONPATH configured for dss-mvp1 and dss-claude-plugin
- .env file with all configuration
- Claude plugin uses ${CLAUDE_PLUGIN_ROOT} for portability

Migration completed: $(date)
🤖 Clean migration with full functionality preserved
2025-12-09 18:45:48 -03:00

79 lines
2.3 KiB
JavaScript

import { DataTypes } from 'sequelize';
export default {
up: async (queryInterface) => {
const transaction = await queryInterface.sequelize.transaction();
try {
await queryInterface.createTable('config_audit_logs', {
id: {
type: DataTypes.UUID,
defaultValue: DataTypes.UUIDV4,
primaryKey: true
},
configId: {
type: DataTypes.UUID,
allowNull: false,
field: 'config_id',
references: {
model: 'config_settings',
key: 'id'
},
onDelete: 'CASCADE'
},
actorId: {
type: DataTypes.UUID,
allowNull: false,
field: 'actor_id',
references: {
model: 'users', // Note: User table name usually lowercase in Postgres if created via Sequelize defaults, or "Users" if strictly quoted
key: 'id'
}
},
action: {
type: DataTypes.ENUM('CREATE', 'UPDATE', 'DELETE'),
allowNull: false
},
previousValue: {
type: DataTypes.JSONB,
allowNull: true,
field: 'previous_value'
},
newValue: {
type: DataTypes.JSONB,
allowNull: true,
field: 'new_value'
},
createdAt: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: DataTypes.NOW,
field: 'created_at'
}
}, { transaction });
// Add indexes for common query patterns
await queryInterface.addIndex('config_audit_logs', ['config_id'], { transaction });
await queryInterface.addIndex('config_audit_logs', ['actor_id'], { transaction });
await queryInterface.addIndex('config_audit_logs', ['created_at'], { transaction });
await transaction.commit();
} catch (err) {
await transaction.rollback();
throw err;
}
},
down: async (queryInterface) => {
const transaction = await queryInterface.sequelize.transaction();
try {
await queryInterface.dropTable('config_audit_logs', { transaction });
await queryInterface.sequelize.query('DROP TYPE IF EXISTS "enum_config_audit_logs_action";', { transaction });
await transaction.commit();
} catch (err) {
await transaction.rollback();
throw err;
}
}
};