All checks were successful
Code quality checks / biome (push) Successful in 10s
- add name validation for channel names and catagories - add create, delete, move for channels
29 lines
664 B
TypeScript
29 lines
664 B
TypeScript
import { cassandra } from "@lib/cassandra";
|
|
|
|
async function createTable() {
|
|
const client = cassandra.getClient();
|
|
|
|
await client.execute(`
|
|
CREATE TABLE IF NOT EXISTS categories (
|
|
id TEXT PRIMARY KEY,
|
|
guild_id TEXT,
|
|
name TEXT,
|
|
position INT,
|
|
created_at TIMESTAMP,
|
|
updated_at TIMESTAMP
|
|
);
|
|
`);
|
|
|
|
await client.execute(`
|
|
CREATE INDEX IF NOT EXISTS categories_guild_id_idx ON categories (guild_id);
|
|
`);
|
|
}
|
|
|
|
async function dropTable() {
|
|
const client = cassandra.getClient();
|
|
|
|
await client.execute("DROP TABLE IF EXISTS categories;");
|
|
await client.execute("DROP INDEX IF EXISTS categories_guild_id_idx;");
|
|
}
|
|
|
|
export { createTable, dropTable };
|