File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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} ;
You can’t perform that action at this time.
0 commit comments