Skip to content

Commit de6df0d

Browse files
committed
added time to event table
1 parent cb42aee commit de6df0d

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
1-
exports.up = function(knex) {
2-
return knex.schema.createTable("events", tbl => {
1+
exports.up = function (knex) {
2+
return knex.schema.createTable("events", (tbl) => {
33
tbl.increments("id");
44
tbl.string("name").notNullable(); // Name of the event
55
tbl.string("location").notNullable(); // Event's location
6-
tbl.timestamp("date").notNullable(); // Event's date and time
6+
tbl.timestamp("date").notNullable(); // Event's date
7+
tbl.string("time").notNullable(); // Event's time
78
tbl.text("description"); // Event description
89
tbl.boolean("attended").defaultTo(false); // Did you attend the event?
9-
tbl
10-
.integer("userId")
11-
.unsigned()
12-
.references("id")
13-
.inTable("users"); // Matches the event to the user
10+
tbl.integer("userId").unsigned().references("id").inTable("users"); // Matches the event to the user
1411
});
1512
};
1613

17-
exports.down = function(knex) {
14+
exports.down = function (knex) {
1815
return knex.schema.dropTableIfExists("events");
1916
};

0 commit comments

Comments
 (0)