LineupSchema constructor
updates:
index
primary
fields: createdAt, updatedAt
Implementation
LineupSchema(
this.collection, {
this.id,
this.database,
}) {
if (LineupDatabase.databases == null ||
(LineupDatabase.databases?.isEmpty ?? true)) {
throw const LineupException(
'Please add `await Lineup.localDatabase(\'YOUR_DATABASE_NAME\');` in the main function.');
} else if (LineupDatabase.databases?.length == 1) {
database ??= LineupDatabase.databases!.keys.first;
if (database != LineupDatabase.databases!.keys.first) {
throw LineupException('Database with ($database) name does not exist!');
}
} else if (database == null) {
throw LineupException(
'Please specify the database field where you define $collection Schema!\n'
'like ** ```TodoSchema() : super("todos", database: "DATABASE_NAME");``` **');
}
}