-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
/
20211016054403_create_base_tables.js
42 lines (41 loc) · 1.26 KB
/
20211016054403_create_base_tables.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
exports.up = async function (knex) {
await knex.schema.createTable('artists', (table) => {
table.uuid('id').primary();
table.string('name');
table.json('members');
});
await knex.schema.createTable('guests', (table) => {
table.uuid('id').primary();
table.string('name');
table.date('birthday');
table.string('search_radius');
table.timestamp('earliest_events_to_show');
table.timestamp('latest_events_to_show');
table.string('password');
table.integer('shows_attended');
table.uuid('favorite_artist').references('id').inTable('artists');
});
await knex.schema.createTable('events', (table) => {
table.uuid('id').primary();
table.timestamp('created_at');
table.float('cost');
table.text('description');
table.text('tags');
table.timestamp('time');
});
await knex.schema.createTable('tours', (table) => {
table.uuid('id').primary();
table.bigInteger('revenue');
});
await knex.schema.createTable('organizers', (table) => {
table.uuid('id').primary();
table.string('company_name');
});
};
exports.down = async function (knex) {
await knex.schema.dropTable('guests');
await knex.schema.dropTable('artists');
await knex.schema.dropTable('events');
await knex.schema.dropTable('organizers');
await knex.schema.dropTable('tours');
};