mirror of
https://gitlab.com/Deukhoofd/BattleSim.git
synced 2025-10-27 18:00:03 +00:00
Lots of stuff
This commit is contained in:
12
migrations/20140430061741_create_teams.coffee
Normal file
12
migrations/20140430061741_create_teams.coffee
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
exports.up = (knex, Promise) ->
|
||||
knex.schema.createTable 'teams', (t) ->
|
||||
t.increments()
|
||||
t.integer('trainer_id').index().notNull()
|
||||
t.string('name').notNull()
|
||||
t.string('generation').notNull()
|
||||
t.json('contents')
|
||||
t.timestamps()
|
||||
|
||||
exports.down = (knex, Promise) ->
|
||||
knex.schema.dropTableIfExists 'teams'
|
||||
11
migrations/20140502015332_allow_null_for_teams.coffee
Normal file
11
migrations/20140502015332_allow_null_for_teams.coffee
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
exports.up = (knex, Promise) ->
|
||||
knex.raw('ALTER TABLE teams ALTER COLUMN name DROP NOT NULL')
|
||||
.then ->
|
||||
knex.raw('ALTER TABLE teams ALTER COLUMN generation DROP NOT NULL')
|
||||
|
||||
|
||||
exports.down = (knex, Promise) ->
|
||||
knex.raw('ALTER TABLE teams ALTER COLUMN name SET NOT NULL')
|
||||
.then ->
|
||||
knex.raw('ALTER TABLE teams ALTER COLUMN generation SET NOT NULL')
|
||||
15
migrations/20140712155810_create_battles.coffee
Normal file
15
migrations/20140712155810_create_battles.coffee
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
exports.up = (knex, Promise) ->
|
||||
knex.schema.createTable 'battles', (t) ->
|
||||
t.increments()
|
||||
t.string('battle_id').index().unique().notNull()
|
||||
t.string('name')
|
||||
t.string('players').notNull()
|
||||
t.string('format').notNull()
|
||||
t.integer('num_active').notNull()
|
||||
t.json('versions')
|
||||
t.json('contents').notNull()
|
||||
t.timestamps()
|
||||
|
||||
exports.down = (knex, Promise) ->
|
||||
knex.schema.dropTableIfExists 'battles'
|
||||
11
migrations/20140717082001_create_saved_battles.coffee
Normal file
11
migrations/20140717082001_create_saved_battles.coffee
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
exports.up = (knex, Promise) ->
|
||||
knex.schema.createTable 'saved_battles', (t) ->
|
||||
t.increments()
|
||||
t.string('battle_id').index().notNull()
|
||||
t.integer('user_id').index().notNull()
|
||||
t.unique(['battle_id', 'user_id'])
|
||||
t.timestamps()
|
||||
|
||||
exports.down = (knex, Promise) ->
|
||||
knex.schema.dropTableIfExists 'saved_battles'
|
||||
Reference in New Issue
Block a user