docs: Add verification guides and summary
This commit is contained in:
@@ -1,45 +0,0 @@
|
||||
import { createDirectus, rest, authentication, deleteField, createField, deleteItems, readItems } from '@directus/sdk';
|
||||
import * as dotenv from 'dotenv';
|
||||
import * as path from 'path';
|
||||
|
||||
dotenv.config({ path: path.resolve(__dirname, '../credentials.env') });
|
||||
|
||||
const client = createDirectus(process.env.DIRECTUS_PUBLIC_URL!).with(authentication()).with(rest());
|
||||
|
||||
async function fixPagesField() {
|
||||
try {
|
||||
await client.login(process.env.DIRECTUS_ADMIN_EMAIL!, process.env.DIRECTUS_ADMIN_PASSWORD!);
|
||||
console.log('🔧 Fixing Pages Schema...');
|
||||
|
||||
// 1. Delete all pages (to allow schema change)
|
||||
console.log(' Deleting existing pages...');
|
||||
// @ts-ignore
|
||||
const pages = await client.request(readItems('pages', { limit: -1, fields: ['id'] }));
|
||||
if (pages.length > 0) {
|
||||
// @ts-ignore
|
||||
await client.request(deleteItems('pages', pages.map(p => p.id)));
|
||||
}
|
||||
|
||||
// 2. Delete site field
|
||||
console.log(' Deleting site field...');
|
||||
try {
|
||||
// @ts-ignore
|
||||
await client.request(deleteField('pages', 'site'));
|
||||
} catch(e) { console.log(' Field might not exist.'); }
|
||||
|
||||
// 3. Re-create site field as UUID
|
||||
console.log(' Creating site field as UUID...');
|
||||
// @ts-ignore
|
||||
await client.request(createField('pages', {
|
||||
field: 'site',
|
||||
type: 'uuid',
|
||||
meta: { interface: 'select-dropdown' },
|
||||
schema: { is_nullable: true }
|
||||
}));
|
||||
|
||||
console.log('✅ Pages Schema Fixed.');
|
||||
} catch (e: any) {
|
||||
console.error('❌ Fix Failed:', e);
|
||||
}
|
||||
}
|
||||
fixPagesField();
|
||||
@@ -1,20 +0,0 @@
|
||||
import { createDirectus, rest, authentication, deleteCollection } from '@directus/sdk';
|
||||
import * as dotenv from 'dotenv';
|
||||
import * as path from 'path';
|
||||
|
||||
dotenv.config({ path: path.resolve(__dirname, '../credentials.env') });
|
||||
|
||||
const client = createDirectus(process.env.DIRECTUS_PUBLIC_URL!).with(authentication()).with(rest());
|
||||
|
||||
async function forceDelete() {
|
||||
try {
|
||||
await client.login(process.env.DIRECTUS_ADMIN_EMAIL!, process.env.DIRECTUS_ADMIN_PASSWORD!);
|
||||
console.log('Attempting delete pages...');
|
||||
// @ts-ignore
|
||||
await client.request(deleteCollection('pages'));
|
||||
console.log('✅ Deleted pages.');
|
||||
} catch (e: any) {
|
||||
console.log('❌ Delete failed:', e);
|
||||
}
|
||||
}
|
||||
forceDelete();
|
||||
@@ -1,16 +0,0 @@
|
||||
import { createDirectus, rest, authentication, readFields } from '@directus/sdk';
|
||||
import * as dotenv from 'dotenv';
|
||||
import * as path from 'path';
|
||||
|
||||
dotenv.config({ path: path.resolve(__dirname, '../credentials.env') });
|
||||
|
||||
const client = createDirectus(process.env.DIRECTUS_PUBLIC_URL!).with(authentication()).with(rest());
|
||||
|
||||
async function inspect() {
|
||||
await client.login(process.env.DIRECTUS_ADMIN_EMAIL!, process.env.DIRECTUS_ADMIN_PASSWORD!);
|
||||
// @ts-ignore
|
||||
const fields = await client.request(readFields('pages'));
|
||||
const blocksField = fields.find((f: any) => f.field === 'blocks');
|
||||
console.log('Blocks Field:', blocksField);
|
||||
}
|
||||
inspect();
|
||||
@@ -1,40 +0,0 @@
|
||||
import { createDirectus, rest, authentication, deleteCollection } from '@directus/sdk';
|
||||
import * as dotenv from 'dotenv';
|
||||
import * as path from 'path';
|
||||
import { exec } from 'child_process';
|
||||
|
||||
dotenv.config({ path: path.resolve(__dirname, '../credentials.env') });
|
||||
|
||||
const client = createDirectus(process.env.DIRECTUS_PUBLIC_URL!).with(authentication()).with(rest());
|
||||
|
||||
async function resetPages() {
|
||||
try {
|
||||
await client.login(process.env.DIRECTUS_ADMIN_EMAIL!, process.env.DIRECTUS_ADMIN_PASSWORD!);
|
||||
|
||||
console.log('🗑️ Deleting pages collection...');
|
||||
try {
|
||||
// @ts-ignore
|
||||
await client.request(deleteCollection('pages'));
|
||||
console.log('✅ Deleted pages collection.');
|
||||
} catch (e: any) {
|
||||
console.log(' Pages collection might not exist or verify failed: ' + e.message);
|
||||
}
|
||||
|
||||
console.log('🔄 Re-running setup schema...');
|
||||
exec('npx tsx backend/scripts/setup_launchpad_schema.ts', (err, stdout, stderr) => {
|
||||
if (err) console.error(stderr);
|
||||
console.log(stdout);
|
||||
|
||||
console.log('🔄 Re-running demo generation...');
|
||||
exec('npx tsx backend/scripts/generate_flagship_demo.ts', (err, stdout, stderr) => {
|
||||
if (err) console.error(stderr);
|
||||
console.log(stdout);
|
||||
});
|
||||
});
|
||||
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
resetPages();
|
||||
Reference in New Issue
Block a user