Commit 549aa106 authored by Ben Beltran's avatar Ben Beltran

Add topics table and seed data

parent 6c80f6da
Pipeline #158346056 passed with stage
in 54 seconds
......@@ -80,5 +80,43 @@ module.exports = {
label: 'forum.name.everything',
position: 12
}
],
topics: [
{
id: '01a3d641-d094-4d42-a4c9-ab48d8c0725a',
forum_id: 'everything',
tags: {
question: 5,
meta: 34,
carrots: 1,
tpbo: 2
},
title: 'This is a topic that has both topics and tags',
created_at: Date.now(),
ttl: 3 * 24 * 60 * 60 * 1000 // 3 days TTL
},
{
id: '4d7b88cb-36af-4ea5-b61c-180c444b2836',
forum_id: 'everything',
title: 'This is a topic that only has a forum',
created_at: Date.now(),
ttl: 3 * 24 * 60 * 60 * 1000 // 3 days TTL
},
{
id: '0954e660-f327-4f58-aba1-8750a57cc419',
title: 'This is a post that only has tags',
tags: {
meta: 20,
question: 1
},
created_at: Date.now(),
ttl: 3 * 24 * 60 * 60 * 1000 // 3 days TTL
},
{
id: '21f792db-ad6b-4d56-aed8-2fc795f77aea',
title: 'This is an unlisted post',
created_at: Date.now(),
ttl: 3 * 24 * 60 * 60 * 1000 // 3 days TTL
}
]
};
'use strict';
const RethinkDB = require('rethinkdb');
const { getConnectionWithDatabase } = require('../db/helpers');
const internals = {
kTableName: 'topics'
};
module.exports.up = async function () {
const connection = await getConnectionWithDatabase();
await RethinkDB.tableCreate(internals.kTableName).run(connection);
};
module.exports.down = async function () {
const connection = await getConnectionWithDatabase();
await RethinkDB.tableDrop(internals.kTableName).run(connection);
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment