mnemo_cards/mnemo_cards_backend/lib/database/tables/statistics.dart
Dmitry fb7780c215
Some checks are pending
Backend CI / test (push) Waiting to run
Backend CI / build (push) Blocked by required conditions
Deploy Mnemo Cards / Deploy Backend (push) Waiting to run
Deploy Mnemo Cards / Deploy Web App (push) Blocked by required conditions
Deploy Mnemo Cards / Final Verification (push) Blocked by required conditions
time
2025-12-14 00:40:59 +03:00

29 lines
1.1 KiB
Dart

import 'package:drift/drift.dart';
import 'users.dart';
import '../converters.dart' show generateUuid;
import '../postgres_constants.dart';
/// Таблица StudySessions - сессии изучения
class StudySessions extends Table {
TextColumn get id => text().withDefault(const Constant('gen_random_uuid()'))();
TextColumn get userId => text().references(Users, #id, onDelete: KeyAction.cascade)();
TextColumn get sessionId => text().nullable().unique()();
DateTimeColumn get startTime => dateTime()();
DateTimeColumn get endTime => dateTime().nullable()();
IntColumn get wordsLearned => integer().withDefault(const Constant(0))();
IntColumn get testsCompleted => integer().withDefault(const Constant(0))();
RealColumn get accuracy => real().withDefault(const Constant(0.0))();
TextColumn get packId => text().nullable()();
TextColumn get testId => text().nullable()();
// Audit
DateTimeColumn get createdAt => dateTime().withDefault(currentTimestamp)();
DateTimeColumn get updatedAt => dateTime().withDefault(currentTimestamp)();
@override
Set<Column> get primaryKey => {id};
}