godcrm/backend/database/migrations/knex/004_create_dashboards.js
GOD CRM Release f89e074dd1
Some checks failed
CI / Lint / Typecheck / Test / Build (push) Has been cancelled
CI / PostgreSQL Integration Tests (push) Has been cancelled
GOD CRM — public scrubbed snapshot
Governed substrate for autonomous agents: scoped identity (passports),
audited actions, MCP workspace. Infra IPs and secrets redacted for public release.
2026-08-10 04:01:45 +03:00

31 lines
1.1 KiB
JavaScript

// backend/database/migrations/knex/004_create_dashboards.js
// Dashboards: Container for widgets
export async function up(knex) {
await knex.schema.createTable('dashboards', (table) => {
table.increments('id').primary();
table.integer('user_id').unsigned()
.references('id').inTable('users').onDelete('CASCADE');
table.integer('space_id').unsigned()
.references('id').inTable('spaces').onDelete('CASCADE');
table.integer('project_id').unsigned()
.references('id').inTable('projects').onDelete('CASCADE');
table.string('name', 255).notNullable();
table.text('description');
table.string('icon', 50).defaultTo('📊');
table.boolean('is_default').defaultTo(false);
table.integer('order_index').defaultTo(0);
// Timestamps
table.timestamp('created_at').defaultTo(knex.fn.now());
table.timestamp('updated_at').defaultTo(knex.fn.now());
// Indexes
table.index('user_id');
table.index('space_id');
table.index('project_id');
});
}
export async function down(knex) {
await knex.schema.dropTableIfExists('dashboards');
}