created tables
This commit is contained in:
6
lib/data/tables/game_table.dart
Normal file
6
lib/data/tables/game_table.dart
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import 'package:drift/drift.dart';
|
||||||
|
|
||||||
|
class GameTable extends Table {
|
||||||
|
IntColumn get id => integer().autoIncrement()();
|
||||||
|
TextColumn get name => text()();
|
||||||
|
}
|
||||||
9
lib/data/tables/group_table.dart
Normal file
9
lib/data/tables/group_table.dart
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import 'package:drift/drift.dart';
|
||||||
|
|
||||||
|
class GroupTable extends Table {
|
||||||
|
TextColumn get id => text()();
|
||||||
|
TextColumn get name => text()();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Set<Column<Object>> get primaryKey => {id};
|
||||||
|
}
|
||||||
12
lib/data/tables/match_table.dart
Normal file
12
lib/data/tables/match_table.dart
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import 'package:drift/drift.dart';
|
||||||
|
import 'game_table.dart';
|
||||||
|
import 'group_table.dart';
|
||||||
|
|
||||||
|
class MatchTable extends Table {
|
||||||
|
TextColumn get id => text()();
|
||||||
|
IntColumn get gameId => integer().references(GameTable, #id)();
|
||||||
|
TextColumn get groupId => text().nullable().references(GroupTable, #id)();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Set<Column<Object>> get primaryKey => {id};
|
||||||
|
}
|
||||||
12
lib/data/tables/result_placement_table.dart
Normal file
12
lib/data/tables/result_placement_table.dart
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import 'package:drift/drift.dart';
|
||||||
|
import 'match_table.dart';
|
||||||
|
import 'user_table.dart';
|
||||||
|
|
||||||
|
class ResultPlacementTable extends Table {
|
||||||
|
TextColumn get matchId => text().references(MatchTable, #id)();
|
||||||
|
TextColumn get userId => text().references(UserTable, #id)();
|
||||||
|
IntColumn get placement => integer()();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Set<Column<Object>> get primaryKey => {matchId, userId};
|
||||||
|
}
|
||||||
12
lib/data/tables/result_score_table.dart
Normal file
12
lib/data/tables/result_score_table.dart
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import 'package:drift/drift.dart';
|
||||||
|
import 'match_table.dart';
|
||||||
|
import 'user_table.dart';
|
||||||
|
|
||||||
|
class ResultScoreTable extends Table {
|
||||||
|
TextColumn get matchId => text().references(MatchTable, #id)();
|
||||||
|
TextColumn get userId => text().references(UserTable, #id)();
|
||||||
|
IntColumn get score => integer()();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Set<Column<Object>> get primaryKey => {matchId, userId};
|
||||||
|
}
|
||||||
11
lib/data/tables/result_win_table.dart
Normal file
11
lib/data/tables/result_win_table.dart
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import 'package:drift/drift.dart';
|
||||||
|
import 'match_table.dart';
|
||||||
|
import 'user_table.dart';
|
||||||
|
|
||||||
|
class ResultWinTable extends Table {
|
||||||
|
TextColumn get matchId => text().references(MatchTable, #id)();
|
||||||
|
TextColumn get winnerId => text().references(UserTable, #id)();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Set<Column<Object>> get primaryKey => {matchId, winnerId};
|
||||||
|
}
|
||||||
12
lib/data/tables/user_group_table.dart
Normal file
12
lib/data/tables/user_group_table.dart
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import 'package:drift/drift.dart';
|
||||||
|
import 'group_table.dart';
|
||||||
|
import 'user_table.dart';
|
||||||
|
|
||||||
|
|
||||||
|
class UserGroupTable extends Table {
|
||||||
|
TextColumn get userId => text().references(UserTable, #id)();
|
||||||
|
TextColumn get groupId => text().references(GroupTable, #id)();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Set<Column<Object>> get primaryKey => {userId, groupId};
|
||||||
|
}
|
||||||
10
lib/data/tables/user_table.dart
Normal file
10
lib/data/tables/user_table.dart
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import 'package:drift/drift.dart';
|
||||||
|
|
||||||
|
class UserTable extends Table {
|
||||||
|
TextColumn get id => text()();
|
||||||
|
TextColumn get name => text()();
|
||||||
|
TextColumn get surname => text().nullable()();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Set<Column<Object>> get primaryKey => {id};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user