-
Notifications
You must be signed in to change notification settings - Fork 516
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
85f25b1
commit 2ad7597
Showing
7 changed files
with
72 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
Week2/QA-session-content/migrations/20200623130136_create_projects.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
exports.up = async (knex) => { | ||
return knex.schema.createTable('projects', function (table) { | ||
table.increments(); | ||
table.string('name').notNullable(); | ||
table.date('start_date'); | ||
table.date('end_date'); | ||
table.string('code').unique(); | ||
table.timestamps(); | ||
}) | ||
}; | ||
|
||
exports.down = async (knex) => { | ||
return knex.schema.dropTableIfExists('projects') | ||
}; |
13 changes: 13 additions & 0 deletions
13
Week2/QA-session-content/migrations/20200623130141_create_users.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
exports.up = async (knex) => { | ||
return knex.schema.createTable('users', function (table) { | ||
table.increments(); | ||
table.string('first_name').notNullable(); | ||
table.string('last_name').notNullable(); | ||
table.timestamps(); | ||
}) | ||
}; | ||
|
||
exports.down = async (knex) => { | ||
return knex.schema.dropTableIfExists('users') | ||
}; |
20 changes: 20 additions & 0 deletions
20
Week2/QA-session-content/migrations/20200623130146_create_tasks.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
exports.up = async (knex) => { | ||
return knex.schema.createTable('tasks', function (table) { | ||
table.increments(); | ||
table.string('name'); | ||
table.integer('assigned_to') | ||
.unsigned() | ||
.references('id') | ||
.inTable('users'); | ||
table.integer('project_id') | ||
.unsigned() | ||
.references('id') | ||
.inTable('projects'); | ||
table.timestamps(); | ||
}) | ||
}; | ||
|
||
exports.down = async (knex) => { | ||
return knex.schema.dropTableIfExists('tasks') | ||
}; |
17 changes: 17 additions & 0 deletions
17
Week2/QA-session-content/migrations/20200623130154_create_project_users.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
exports.up = async (knex) => { | ||
return knex.schema.createTable('project_users', function (table) { | ||
table.integer('user_id') | ||
.unsigned() | ||
.references('id') | ||
.inTable('users'); | ||
table.integer('project_id') | ||
.unsigned() | ||
.references('id') | ||
.inTable('projects'); | ||
}) | ||
}; | ||
|
||
exports.down = async (knex) => { | ||
return knex.schema.dropTableIfExists('project_users') | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters