diff options
author | vantezzen <properly@protonmail.com> | 2019-08-22 11:12:36 +0200 |
---|---|---|
committer | vantezzen <properly@protonmail.com> | 2019-08-22 11:12:36 +0200 |
commit | b018adf240679ec59a7344e30be39400f1ecd8af (patch) | |
tree | c076635761667dad302716b498088f1047281e46 /database | |
download | ferdium-server-b018adf240679ec59a7344e30be39400f1ecd8af.tar.gz ferdium-server-b018adf240679ec59a7344e30be39400f1ecd8af.tar.zst ferdium-server-b018adf240679ec59a7344e30be39400f1ecd8af.zip |
Initial commit
Diffstat (limited to 'database')
-rw-r--r-- | database/adonis.sqlite | bin | 0 -> 45056 bytes | |||
-rw-r--r-- | database/factory.js | 21 | ||||
-rw-r--r-- | database/migrations/1503250034279_user.js | 22 | ||||
-rw-r--r-- | database/migrations/1503250034280_token.js | 23 | ||||
-rw-r--r-- | database/migrations/1566385379883_service_schema.js | 23 |
5 files changed, 89 insertions, 0 deletions
diff --git a/database/adonis.sqlite b/database/adonis.sqlite new file mode 100644 index 0000000..9042fc9 --- /dev/null +++ b/database/adonis.sqlite | |||
Binary files differ | |||
diff --git a/database/factory.js b/database/factory.js new file mode 100644 index 0000000..16b5084 --- /dev/null +++ b/database/factory.js | |||
@@ -0,0 +1,21 @@ | |||
1 | 'use strict' | ||
2 | |||
3 | /* | ||
4 | |-------------------------------------------------------------------------- | ||
5 | | Factory | ||
6 | |-------------------------------------------------------------------------- | ||
7 | | | ||
8 | | Factories are used to define blueprints for database tables or Lucid | ||
9 | | models. Later you can use these blueprints to seed your database | ||
10 | | with dummy data. | ||
11 | | | ||
12 | */ | ||
13 | |||
14 | /** @type {import('@adonisjs/lucid/src/Factory')} */ | ||
15 | // const Factory = use('Factory') | ||
16 | |||
17 | // Factory.blueprint('App/Models/User', (faker) => { | ||
18 | // return { | ||
19 | // username: faker.username() | ||
20 | // } | ||
21 | // }) | ||
diff --git a/database/migrations/1503250034279_user.js b/database/migrations/1503250034279_user.js new file mode 100644 index 0000000..9148593 --- /dev/null +++ b/database/migrations/1503250034279_user.js | |||
@@ -0,0 +1,22 @@ | |||
1 | 'use strict' | ||
2 | |||
3 | /** @type {import('@adonisjs/lucid/src/Schema')} */ | ||
4 | const Schema = use('Schema') | ||
5 | |||
6 | class UserSchema extends Schema { | ||
7 | up () { | ||
8 | this.create('users', (table) => { | ||
9 | table.increments() | ||
10 | table.string('username', 80).notNullable() | ||
11 | table.string('email', 254).notNullable().unique() | ||
12 | table.string('password', 60).notNullable() | ||
13 | table.timestamps() | ||
14 | }) | ||
15 | } | ||
16 | |||
17 | down () { | ||
18 | this.drop('users') | ||
19 | } | ||
20 | } | ||
21 | |||
22 | module.exports = UserSchema | ||
diff --git a/database/migrations/1503250034280_token.js b/database/migrations/1503250034280_token.js new file mode 100644 index 0000000..c8bb9fc --- /dev/null +++ b/database/migrations/1503250034280_token.js | |||
@@ -0,0 +1,23 @@ | |||
1 | 'use strict' | ||
2 | |||
3 | /** @type {import('@adonisjs/lucid/src/Schema')} */ | ||
4 | const Schema = use('Schema') | ||
5 | |||
6 | class TokensSchema extends Schema { | ||
7 | up () { | ||
8 | this.create('tokens', (table) => { | ||
9 | table.increments() | ||
10 | table.integer('user_id').unsigned().references('id').inTable('users') | ||
11 | table.string('token', 255).notNullable().unique().index() | ||
12 | table.string('type', 80).notNullable() | ||
13 | table.boolean('is_revoked').defaultTo(false) | ||
14 | table.timestamps() | ||
15 | }) | ||
16 | } | ||
17 | |||
18 | down () { | ||
19 | this.drop('tokens') | ||
20 | } | ||
21 | } | ||
22 | |||
23 | module.exports = TokensSchema | ||
diff --git a/database/migrations/1566385379883_service_schema.js b/database/migrations/1566385379883_service_schema.js new file mode 100644 index 0000000..bdc066e --- /dev/null +++ b/database/migrations/1566385379883_service_schema.js | |||
@@ -0,0 +1,23 @@ | |||
1 | 'use strict' | ||
2 | |||
3 | /** @type {import('@adonisjs/lucid/src/Schema')} */ | ||
4 | const Schema = use('Schema') | ||
5 | |||
6 | class ServiceSchema extends Schema { | ||
7 | up () { | ||
8 | this.create('services', (table) => { | ||
9 | table.increments() | ||
10 | table.string('userId', 80).notNullable() | ||
11 | table.string('name', 80).notNullable() | ||
12 | table.string('recipeId', 254).notNullable() | ||
13 | table.json('settings') | ||
14 | table.timestamps() | ||
15 | }) | ||
16 | } | ||
17 | |||
18 | down () { | ||
19 | this.drop('services') | ||
20 | } | ||
21 | } | ||
22 | |||
23 | module.exports = ServiceSchema | ||