Files
MrbWebLibre/apps/weblibre/test/drift/tabs/generated/schema_v14.dart
T

3199 lines
113 KiB
Dart

// dart format width=80
// GENERATED BY drift_dev, DO NOT MODIFY.
// ignore_for_file: type=lint,unused_import
//
import 'package:drift/drift.dart';
class Container extends Table with TableInfo<Container, ContainerData> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
Container(this.attachedDatabase, [this._alias]);
late final GeneratedColumn<String> id = GeneratedColumn<String>(
'id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
$customConstraints: 'PRIMARY KEY NOT NULL',
);
late final GeneratedColumn<String> name = GeneratedColumn<String>(
'name',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
$customConstraints: '',
);
late final GeneratedColumn<int> color = GeneratedColumn<int>(
'color',
aliasedName,
false,
type: DriftSqlType.int,
requiredDuringInsert: true,
$customConstraints: 'NOT NULL',
);
late final GeneratedColumn<String> orderKey = GeneratedColumn<String>(
'order_key',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
$customConstraints: 'NOT NULL',
);
late final GeneratedColumn<int> isPinned = GeneratedColumn<int>(
'is_pinned',
aliasedName,
false,
type: DriftSqlType.int,
requiredDuringInsert: false,
$customConstraints: 'NOT NULL DEFAULT 0',
defaultValue: const CustomExpression('0'),
);
late final GeneratedColumn<String> metadata = GeneratedColumn<String>(
'metadata',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
$customConstraints: '',
);
@override
List<GeneratedColumn> get $columns => [
id,
name,
color,
orderKey,
isPinned,
metadata,
];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'container';
@override
Set<GeneratedColumn> get $primaryKey => {id};
@override
ContainerData map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return ContainerData(
id: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}id'],
)!,
name: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}name'],
),
color: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}color'],
)!,
orderKey: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}order_key'],
)!,
isPinned: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}is_pinned'],
)!,
metadata: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}metadata'],
),
);
}
@override
Container createAlias(String alias) {
return Container(attachedDatabase, alias);
}
@override
bool get dontWriteConstraints => true;
}
class ContainerData extends DataClass implements Insertable<ContainerData> {
final String id;
final String? name;
final int color;
final String orderKey;
final int isPinned;
final String? metadata;
const ContainerData({
required this.id,
this.name,
required this.color,
required this.orderKey,
required this.isPinned,
this.metadata,
});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['id'] = Variable<String>(id);
if (!nullToAbsent || name != null) {
map['name'] = Variable<String>(name);
}
map['color'] = Variable<int>(color);
map['order_key'] = Variable<String>(orderKey);
map['is_pinned'] = Variable<int>(isPinned);
if (!nullToAbsent || metadata != null) {
map['metadata'] = Variable<String>(metadata);
}
return map;
}
factory ContainerData.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return ContainerData(
id: serializer.fromJson<String>(json['id']),
name: serializer.fromJson<String?>(json['name']),
color: serializer.fromJson<int>(json['color']),
orderKey: serializer.fromJson<String>(json['orderKey']),
isPinned: serializer.fromJson<int>(json['isPinned']),
metadata: serializer.fromJson<String?>(json['metadata']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'id': serializer.toJson<String>(id),
'name': serializer.toJson<String?>(name),
'color': serializer.toJson<int>(color),
'orderKey': serializer.toJson<String>(orderKey),
'isPinned': serializer.toJson<int>(isPinned),
'metadata': serializer.toJson<String?>(metadata),
};
}
ContainerData copyWith({
String? id,
Value<String?> name = const Value.absent(),
int? color,
String? orderKey,
int? isPinned,
Value<String?> metadata = const Value.absent(),
}) => ContainerData(
id: id ?? this.id,
name: name.present ? name.value : this.name,
color: color ?? this.color,
orderKey: orderKey ?? this.orderKey,
isPinned: isPinned ?? this.isPinned,
metadata: metadata.present ? metadata.value : this.metadata,
);
ContainerData copyWithCompanion(ContainerCompanion data) {
return ContainerData(
id: data.id.present ? data.id.value : this.id,
name: data.name.present ? data.name.value : this.name,
color: data.color.present ? data.color.value : this.color,
orderKey: data.orderKey.present ? data.orderKey.value : this.orderKey,
isPinned: data.isPinned.present ? data.isPinned.value : this.isPinned,
metadata: data.metadata.present ? data.metadata.value : this.metadata,
);
}
@override
String toString() {
return (StringBuffer('ContainerData(')
..write('id: $id, ')
..write('name: $name, ')
..write('color: $color, ')
..write('orderKey: $orderKey, ')
..write('isPinned: $isPinned, ')
..write('metadata: $metadata')
..write(')'))
.toString();
}
@override
int get hashCode =>
Object.hash(id, name, color, orderKey, isPinned, metadata);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is ContainerData &&
other.id == this.id &&
other.name == this.name &&
other.color == this.color &&
other.orderKey == this.orderKey &&
other.isPinned == this.isPinned &&
other.metadata == this.metadata);
}
class ContainerCompanion extends UpdateCompanion<ContainerData> {
final Value<String> id;
final Value<String?> name;
final Value<int> color;
final Value<String> orderKey;
final Value<int> isPinned;
final Value<String?> metadata;
final Value<int> rowid;
const ContainerCompanion({
this.id = const Value.absent(),
this.name = const Value.absent(),
this.color = const Value.absent(),
this.orderKey = const Value.absent(),
this.isPinned = const Value.absent(),
this.metadata = const Value.absent(),
this.rowid = const Value.absent(),
});
ContainerCompanion.insert({
required String id,
this.name = const Value.absent(),
required int color,
required String orderKey,
this.isPinned = const Value.absent(),
this.metadata = const Value.absent(),
this.rowid = const Value.absent(),
}) : id = Value(id),
color = Value(color),
orderKey = Value(orderKey);
static Insertable<ContainerData> custom({
Expression<String>? id,
Expression<String>? name,
Expression<int>? color,
Expression<String>? orderKey,
Expression<int>? isPinned,
Expression<String>? metadata,
Expression<int>? rowid,
}) {
return RawValuesInsertable({
if (id != null) 'id': id,
if (name != null) 'name': name,
if (color != null) 'color': color,
if (orderKey != null) 'order_key': orderKey,
if (isPinned != null) 'is_pinned': isPinned,
if (metadata != null) 'metadata': metadata,
if (rowid != null) 'rowid': rowid,
});
}
ContainerCompanion copyWith({
Value<String>? id,
Value<String?>? name,
Value<int>? color,
Value<String>? orderKey,
Value<int>? isPinned,
Value<String?>? metadata,
Value<int>? rowid,
}) {
return ContainerCompanion(
id: id ?? this.id,
name: name ?? this.name,
color: color ?? this.color,
orderKey: orderKey ?? this.orderKey,
isPinned: isPinned ?? this.isPinned,
metadata: metadata ?? this.metadata,
rowid: rowid ?? this.rowid,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (id.present) {
map['id'] = Variable<String>(id.value);
}
if (name.present) {
map['name'] = Variable<String>(name.value);
}
if (color.present) {
map['color'] = Variable<int>(color.value);
}
if (orderKey.present) {
map['order_key'] = Variable<String>(orderKey.value);
}
if (isPinned.present) {
map['is_pinned'] = Variable<int>(isPinned.value);
}
if (metadata.present) {
map['metadata'] = Variable<String>(metadata.value);
}
if (rowid.present) {
map['rowid'] = Variable<int>(rowid.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('ContainerCompanion(')
..write('id: $id, ')
..write('name: $name, ')
..write('color: $color, ')
..write('orderKey: $orderKey, ')
..write('isPinned: $isPinned, ')
..write('metadata: $metadata, ')
..write('rowid: $rowid')
..write(')'))
.toString();
}
}
class Tab extends Table with TableInfo<Tab, TabData> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
Tab(this.attachedDatabase, [this._alias]);
late final GeneratedColumn<String> id = GeneratedColumn<String>(
'id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
$customConstraints: 'PRIMARY KEY NOT NULL',
);
late final GeneratedColumn<int> source = GeneratedColumn<int>(
'source',
aliasedName,
false,
type: DriftSqlType.int,
requiredDuringInsert: true,
$customConstraints: 'NOT NULL',
);
late final GeneratedColumn<String> parentId = GeneratedColumn<String>(
'parent_id',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
$customConstraints: 'REFERENCES tab(id)ON DELETE SET NULL',
);
late final GeneratedColumn<String> containerId = GeneratedColumn<String>(
'container_id',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
$customConstraints: 'REFERENCES container(id)ON DELETE CASCADE',
);
late final GeneratedColumn<String> orderKey = GeneratedColumn<String>(
'order_key',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
$customConstraints: 'NOT NULL',
);
late final GeneratedColumn<String> url = GeneratedColumn<String>(
'url',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
$customConstraints: '',
);
late final GeneratedColumn<String> title = GeneratedColumn<String>(
'title',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
$customConstraints: '',
);
late final GeneratedColumn<int> tabMode = GeneratedColumn<int>(
'tab_mode',
aliasedName,
false,
type: DriftSqlType.int,
requiredDuringInsert: false,
$customConstraints: 'NOT NULL DEFAULT 0',
defaultValue: const CustomExpression('0'),
);
late final GeneratedColumn<String> isolationContextId =
GeneratedColumn<String>(
'isolation_context_id',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
$customConstraints: '',
);
late final GeneratedColumn<int> isPinned = GeneratedColumn<int>(
'is_pinned',
aliasedName,
false,
type: DriftSqlType.int,
requiredDuringInsert: false,
$customConstraints: 'NOT NULL DEFAULT 0',
defaultValue: const CustomExpression('0'),
);
late final GeneratedColumn<int> isProbablyReaderable = GeneratedColumn<int>(
'is_probably_readerable',
aliasedName,
true,
type: DriftSqlType.int,
requiredDuringInsert: false,
$customConstraints: '',
);
late final GeneratedColumn<String> extractedContentMarkdown =
GeneratedColumn<String>(
'extracted_content_markdown',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
$customConstraints: '',
);
late final GeneratedColumn<String> extractedContentPlain =
GeneratedColumn<String>(
'extracted_content_plain',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
$customConstraints: '',
);
late final GeneratedColumn<String> fullContentMarkdown =
GeneratedColumn<String>(
'full_content_markdown',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
$customConstraints: '',
);
late final GeneratedColumn<String> fullContentPlain = GeneratedColumn<String>(
'full_content_plain',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
$customConstraints: '',
);
late final GeneratedColumn<int> timestamp = GeneratedColumn<int>(
'timestamp',
aliasedName,
false,
type: DriftSqlType.int,
requiredDuringInsert: true,
$customConstraints: 'NOT NULL',
);
late final GeneratedColumn<int> contentHash = GeneratedColumn<int>(
'content_hash',
aliasedName,
true,
generatedAs: GeneratedAs(
const CustomExpression(
'generate_content_hash(title, extracted_content_plain, full_content_plain)',
),
false,
),
type: DriftSqlType.int,
requiredDuringInsert: false,
$customConstraints:
'GENERATED ALWAYS AS (generate_content_hash(title, extracted_content_plain, full_content_plain)) VIRTUAL',
);
@override
List<GeneratedColumn> get $columns => [
id,
source,
parentId,
containerId,
orderKey,
url,
title,
tabMode,
isolationContextId,
isPinned,
isProbablyReaderable,
extractedContentMarkdown,
extractedContentPlain,
fullContentMarkdown,
fullContentPlain,
timestamp,
contentHash,
];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'tab';
@override
Set<GeneratedColumn> get $primaryKey => {id};
@override
TabData map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return TabData(
id: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}id'],
)!,
source: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}source'],
)!,
parentId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}parent_id'],
),
containerId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}container_id'],
),
orderKey: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}order_key'],
)!,
url: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}url'],
),
title: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}title'],
),
tabMode: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}tab_mode'],
)!,
isolationContextId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}isolation_context_id'],
),
isPinned: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}is_pinned'],
)!,
isProbablyReaderable: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}is_probably_readerable'],
),
extractedContentMarkdown: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}extracted_content_markdown'],
),
extractedContentPlain: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}extracted_content_plain'],
),
fullContentMarkdown: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}full_content_markdown'],
),
fullContentPlain: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}full_content_plain'],
),
timestamp: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}timestamp'],
)!,
contentHash: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}content_hash'],
),
);
}
@override
Tab createAlias(String alias) {
return Tab(attachedDatabase, alias);
}
@override
List<String> get customConstraints => const [
'CHECK((tab_mode = 2 AND isolation_context_id IS NOT NULL)OR(tab_mode != 2 AND isolation_context_id IS NULL))',
];
@override
bool get dontWriteConstraints => true;
}
class TabData extends DataClass implements Insertable<TabData> {
final String id;
final int source;
final String? parentId;
final String? containerId;
final String orderKey;
final String? url;
final String? title;
final int tabMode;
final String? isolationContextId;
final int isPinned;
final int? isProbablyReaderable;
final String? extractedContentMarkdown;
final String? extractedContentPlain;
final String? fullContentMarkdown;
final String? fullContentPlain;
final int timestamp;
final int? contentHash;
const TabData({
required this.id,
required this.source,
this.parentId,
this.containerId,
required this.orderKey,
this.url,
this.title,
required this.tabMode,
this.isolationContextId,
required this.isPinned,
this.isProbablyReaderable,
this.extractedContentMarkdown,
this.extractedContentPlain,
this.fullContentMarkdown,
this.fullContentPlain,
required this.timestamp,
this.contentHash,
});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['id'] = Variable<String>(id);
map['source'] = Variable<int>(source);
if (!nullToAbsent || parentId != null) {
map['parent_id'] = Variable<String>(parentId);
}
if (!nullToAbsent || containerId != null) {
map['container_id'] = Variable<String>(containerId);
}
map['order_key'] = Variable<String>(orderKey);
if (!nullToAbsent || url != null) {
map['url'] = Variable<String>(url);
}
if (!nullToAbsent || title != null) {
map['title'] = Variable<String>(title);
}
map['tab_mode'] = Variable<int>(tabMode);
if (!nullToAbsent || isolationContextId != null) {
map['isolation_context_id'] = Variable<String>(isolationContextId);
}
map['is_pinned'] = Variable<int>(isPinned);
if (!nullToAbsent || isProbablyReaderable != null) {
map['is_probably_readerable'] = Variable<int>(isProbablyReaderable);
}
if (!nullToAbsent || extractedContentMarkdown != null) {
map['extracted_content_markdown'] = Variable<String>(
extractedContentMarkdown,
);
}
if (!nullToAbsent || extractedContentPlain != null) {
map['extracted_content_plain'] = Variable<String>(extractedContentPlain);
}
if (!nullToAbsent || fullContentMarkdown != null) {
map['full_content_markdown'] = Variable<String>(fullContentMarkdown);
}
if (!nullToAbsent || fullContentPlain != null) {
map['full_content_plain'] = Variable<String>(fullContentPlain);
}
map['timestamp'] = Variable<int>(timestamp);
return map;
}
factory TabData.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return TabData(
id: serializer.fromJson<String>(json['id']),
source: serializer.fromJson<int>(json['source']),
parentId: serializer.fromJson<String?>(json['parentId']),
containerId: serializer.fromJson<String?>(json['containerId']),
orderKey: serializer.fromJson<String>(json['orderKey']),
url: serializer.fromJson<String?>(json['url']),
title: serializer.fromJson<String?>(json['title']),
tabMode: serializer.fromJson<int>(json['tabMode']),
isolationContextId: serializer.fromJson<String?>(
json['isolationContextId'],
),
isPinned: serializer.fromJson<int>(json['isPinned']),
isProbablyReaderable: serializer.fromJson<int?>(
json['isProbablyReaderable'],
),
extractedContentMarkdown: serializer.fromJson<String?>(
json['extractedContentMarkdown'],
),
extractedContentPlain: serializer.fromJson<String?>(
json['extractedContentPlain'],
),
fullContentMarkdown: serializer.fromJson<String?>(
json['fullContentMarkdown'],
),
fullContentPlain: serializer.fromJson<String?>(json['fullContentPlain']),
timestamp: serializer.fromJson<int>(json['timestamp']),
contentHash: serializer.fromJson<int?>(json['contentHash']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'id': serializer.toJson<String>(id),
'source': serializer.toJson<int>(source),
'parentId': serializer.toJson<String?>(parentId),
'containerId': serializer.toJson<String?>(containerId),
'orderKey': serializer.toJson<String>(orderKey),
'url': serializer.toJson<String?>(url),
'title': serializer.toJson<String?>(title),
'tabMode': serializer.toJson<int>(tabMode),
'isolationContextId': serializer.toJson<String?>(isolationContextId),
'isPinned': serializer.toJson<int>(isPinned),
'isProbablyReaderable': serializer.toJson<int?>(isProbablyReaderable),
'extractedContentMarkdown': serializer.toJson<String?>(
extractedContentMarkdown,
),
'extractedContentPlain': serializer.toJson<String?>(
extractedContentPlain,
),
'fullContentMarkdown': serializer.toJson<String?>(fullContentMarkdown),
'fullContentPlain': serializer.toJson<String?>(fullContentPlain),
'timestamp': serializer.toJson<int>(timestamp),
'contentHash': serializer.toJson<int?>(contentHash),
};
}
TabData copyWith({
String? id,
int? source,
Value<String?> parentId = const Value.absent(),
Value<String?> containerId = const Value.absent(),
String? orderKey,
Value<String?> url = const Value.absent(),
Value<String?> title = const Value.absent(),
int? tabMode,
Value<String?> isolationContextId = const Value.absent(),
int? isPinned,
Value<int?> isProbablyReaderable = const Value.absent(),
Value<String?> extractedContentMarkdown = const Value.absent(),
Value<String?> extractedContentPlain = const Value.absent(),
Value<String?> fullContentMarkdown = const Value.absent(),
Value<String?> fullContentPlain = const Value.absent(),
int? timestamp,
Value<int?> contentHash = const Value.absent(),
}) => TabData(
id: id ?? this.id,
source: source ?? this.source,
parentId: parentId.present ? parentId.value : this.parentId,
containerId: containerId.present ? containerId.value : this.containerId,
orderKey: orderKey ?? this.orderKey,
url: url.present ? url.value : this.url,
title: title.present ? title.value : this.title,
tabMode: tabMode ?? this.tabMode,
isolationContextId: isolationContextId.present
? isolationContextId.value
: this.isolationContextId,
isPinned: isPinned ?? this.isPinned,
isProbablyReaderable: isProbablyReaderable.present
? isProbablyReaderable.value
: this.isProbablyReaderable,
extractedContentMarkdown: extractedContentMarkdown.present
? extractedContentMarkdown.value
: this.extractedContentMarkdown,
extractedContentPlain: extractedContentPlain.present
? extractedContentPlain.value
: this.extractedContentPlain,
fullContentMarkdown: fullContentMarkdown.present
? fullContentMarkdown.value
: this.fullContentMarkdown,
fullContentPlain: fullContentPlain.present
? fullContentPlain.value
: this.fullContentPlain,
timestamp: timestamp ?? this.timestamp,
contentHash: contentHash.present ? contentHash.value : this.contentHash,
);
@override
String toString() {
return (StringBuffer('TabData(')
..write('id: $id, ')
..write('source: $source, ')
..write('parentId: $parentId, ')
..write('containerId: $containerId, ')
..write('orderKey: $orderKey, ')
..write('url: $url, ')
..write('title: $title, ')
..write('tabMode: $tabMode, ')
..write('isolationContextId: $isolationContextId, ')
..write('isPinned: $isPinned, ')
..write('isProbablyReaderable: $isProbablyReaderable, ')
..write('extractedContentMarkdown: $extractedContentMarkdown, ')
..write('extractedContentPlain: $extractedContentPlain, ')
..write('fullContentMarkdown: $fullContentMarkdown, ')
..write('fullContentPlain: $fullContentPlain, ')
..write('timestamp: $timestamp, ')
..write('contentHash: $contentHash')
..write(')'))
.toString();
}
@override
int get hashCode => Object.hash(
id,
source,
parentId,
containerId,
orderKey,
url,
title,
tabMode,
isolationContextId,
isPinned,
isProbablyReaderable,
extractedContentMarkdown,
extractedContentPlain,
fullContentMarkdown,
fullContentPlain,
timestamp,
contentHash,
);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is TabData &&
other.id == this.id &&
other.source == this.source &&
other.parentId == this.parentId &&
other.containerId == this.containerId &&
other.orderKey == this.orderKey &&
other.url == this.url &&
other.title == this.title &&
other.tabMode == this.tabMode &&
other.isolationContextId == this.isolationContextId &&
other.isPinned == this.isPinned &&
other.isProbablyReaderable == this.isProbablyReaderable &&
other.extractedContentMarkdown == this.extractedContentMarkdown &&
other.extractedContentPlain == this.extractedContentPlain &&
other.fullContentMarkdown == this.fullContentMarkdown &&
other.fullContentPlain == this.fullContentPlain &&
other.timestamp == this.timestamp &&
other.contentHash == this.contentHash);
}
class TabCompanion extends UpdateCompanion<TabData> {
final Value<String> id;
final Value<int> source;
final Value<String?> parentId;
final Value<String?> containerId;
final Value<String> orderKey;
final Value<String?> url;
final Value<String?> title;
final Value<int> tabMode;
final Value<String?> isolationContextId;
final Value<int> isPinned;
final Value<int?> isProbablyReaderable;
final Value<String?> extractedContentMarkdown;
final Value<String?> extractedContentPlain;
final Value<String?> fullContentMarkdown;
final Value<String?> fullContentPlain;
final Value<int> timestamp;
final Value<int> rowid;
const TabCompanion({
this.id = const Value.absent(),
this.source = const Value.absent(),
this.parentId = const Value.absent(),
this.containerId = const Value.absent(),
this.orderKey = const Value.absent(),
this.url = const Value.absent(),
this.title = const Value.absent(),
this.tabMode = const Value.absent(),
this.isolationContextId = const Value.absent(),
this.isPinned = const Value.absent(),
this.isProbablyReaderable = const Value.absent(),
this.extractedContentMarkdown = const Value.absent(),
this.extractedContentPlain = const Value.absent(),
this.fullContentMarkdown = const Value.absent(),
this.fullContentPlain = const Value.absent(),
this.timestamp = const Value.absent(),
this.rowid = const Value.absent(),
});
TabCompanion.insert({
required String id,
required int source,
this.parentId = const Value.absent(),
this.containerId = const Value.absent(),
required String orderKey,
this.url = const Value.absent(),
this.title = const Value.absent(),
this.tabMode = const Value.absent(),
this.isolationContextId = const Value.absent(),
this.isPinned = const Value.absent(),
this.isProbablyReaderable = const Value.absent(),
this.extractedContentMarkdown = const Value.absent(),
this.extractedContentPlain = const Value.absent(),
this.fullContentMarkdown = const Value.absent(),
this.fullContentPlain = const Value.absent(),
required int timestamp,
this.rowid = const Value.absent(),
}) : id = Value(id),
source = Value(source),
orderKey = Value(orderKey),
timestamp = Value(timestamp);
static Insertable<TabData> custom({
Expression<String>? id,
Expression<int>? source,
Expression<String>? parentId,
Expression<String>? containerId,
Expression<String>? orderKey,
Expression<String>? url,
Expression<String>? title,
Expression<int>? tabMode,
Expression<String>? isolationContextId,
Expression<int>? isPinned,
Expression<int>? isProbablyReaderable,
Expression<String>? extractedContentMarkdown,
Expression<String>? extractedContentPlain,
Expression<String>? fullContentMarkdown,
Expression<String>? fullContentPlain,
Expression<int>? timestamp,
Expression<int>? rowid,
}) {
return RawValuesInsertable({
if (id != null) 'id': id,
if (source != null) 'source': source,
if (parentId != null) 'parent_id': parentId,
if (containerId != null) 'container_id': containerId,
if (orderKey != null) 'order_key': orderKey,
if (url != null) 'url': url,
if (title != null) 'title': title,
if (tabMode != null) 'tab_mode': tabMode,
if (isolationContextId != null)
'isolation_context_id': isolationContextId,
if (isPinned != null) 'is_pinned': isPinned,
if (isProbablyReaderable != null)
'is_probably_readerable': isProbablyReaderable,
if (extractedContentMarkdown != null)
'extracted_content_markdown': extractedContentMarkdown,
if (extractedContentPlain != null)
'extracted_content_plain': extractedContentPlain,
if (fullContentMarkdown != null)
'full_content_markdown': fullContentMarkdown,
if (fullContentPlain != null) 'full_content_plain': fullContentPlain,
if (timestamp != null) 'timestamp': timestamp,
if (rowid != null) 'rowid': rowid,
});
}
TabCompanion copyWith({
Value<String>? id,
Value<int>? source,
Value<String?>? parentId,
Value<String?>? containerId,
Value<String>? orderKey,
Value<String?>? url,
Value<String?>? title,
Value<int>? tabMode,
Value<String?>? isolationContextId,
Value<int>? isPinned,
Value<int?>? isProbablyReaderable,
Value<String?>? extractedContentMarkdown,
Value<String?>? extractedContentPlain,
Value<String?>? fullContentMarkdown,
Value<String?>? fullContentPlain,
Value<int>? timestamp,
Value<int>? rowid,
}) {
return TabCompanion(
id: id ?? this.id,
source: source ?? this.source,
parentId: parentId ?? this.parentId,
containerId: containerId ?? this.containerId,
orderKey: orderKey ?? this.orderKey,
url: url ?? this.url,
title: title ?? this.title,
tabMode: tabMode ?? this.tabMode,
isolationContextId: isolationContextId ?? this.isolationContextId,
isPinned: isPinned ?? this.isPinned,
isProbablyReaderable: isProbablyReaderable ?? this.isProbablyReaderable,
extractedContentMarkdown:
extractedContentMarkdown ?? this.extractedContentMarkdown,
extractedContentPlain:
extractedContentPlain ?? this.extractedContentPlain,
fullContentMarkdown: fullContentMarkdown ?? this.fullContentMarkdown,
fullContentPlain: fullContentPlain ?? this.fullContentPlain,
timestamp: timestamp ?? this.timestamp,
rowid: rowid ?? this.rowid,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (id.present) {
map['id'] = Variable<String>(id.value);
}
if (source.present) {
map['source'] = Variable<int>(source.value);
}
if (parentId.present) {
map['parent_id'] = Variable<String>(parentId.value);
}
if (containerId.present) {
map['container_id'] = Variable<String>(containerId.value);
}
if (orderKey.present) {
map['order_key'] = Variable<String>(orderKey.value);
}
if (url.present) {
map['url'] = Variable<String>(url.value);
}
if (title.present) {
map['title'] = Variable<String>(title.value);
}
if (tabMode.present) {
map['tab_mode'] = Variable<int>(tabMode.value);
}
if (isolationContextId.present) {
map['isolation_context_id'] = Variable<String>(isolationContextId.value);
}
if (isPinned.present) {
map['is_pinned'] = Variable<int>(isPinned.value);
}
if (isProbablyReaderable.present) {
map['is_probably_readerable'] = Variable<int>(isProbablyReaderable.value);
}
if (extractedContentMarkdown.present) {
map['extracted_content_markdown'] = Variable<String>(
extractedContentMarkdown.value,
);
}
if (extractedContentPlain.present) {
map['extracted_content_plain'] = Variable<String>(
extractedContentPlain.value,
);
}
if (fullContentMarkdown.present) {
map['full_content_markdown'] = Variable<String>(
fullContentMarkdown.value,
);
}
if (fullContentPlain.present) {
map['full_content_plain'] = Variable<String>(fullContentPlain.value);
}
if (timestamp.present) {
map['timestamp'] = Variable<int>(timestamp.value);
}
if (rowid.present) {
map['rowid'] = Variable<int>(rowid.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('TabCompanion(')
..write('id: $id, ')
..write('source: $source, ')
..write('parentId: $parentId, ')
..write('containerId: $containerId, ')
..write('orderKey: $orderKey, ')
..write('url: $url, ')
..write('title: $title, ')
..write('tabMode: $tabMode, ')
..write('isolationContextId: $isolationContextId, ')
..write('isPinned: $isPinned, ')
..write('isProbablyReaderable: $isProbablyReaderable, ')
..write('extractedContentMarkdown: $extractedContentMarkdown, ')
..write('extractedContentPlain: $extractedContentPlain, ')
..write('fullContentMarkdown: $fullContentMarkdown, ')
..write('fullContentPlain: $fullContentPlain, ')
..write('timestamp: $timestamp, ')
..write('rowid: $rowid')
..write(')'))
.toString();
}
}
class ClosedTabTombstone extends Table
with TableInfo<ClosedTabTombstone, ClosedTabTombstoneData> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
ClosedTabTombstone(this.attachedDatabase, [this._alias]);
late final GeneratedColumn<String> tabId = GeneratedColumn<String>(
'tab_id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
$customConstraints: 'PRIMARY KEY NOT NULL',
);
late final GeneratedColumn<int> closedAt = GeneratedColumn<int>(
'closed_at',
aliasedName,
false,
type: DriftSqlType.int,
requiredDuringInsert: true,
$customConstraints: 'NOT NULL',
);
@override
List<GeneratedColumn> get $columns => [tabId, closedAt];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'closed_tab_tombstone';
@override
Set<GeneratedColumn> get $primaryKey => {tabId};
@override
ClosedTabTombstoneData map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return ClosedTabTombstoneData(
tabId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}tab_id'],
)!,
closedAt: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}closed_at'],
)!,
);
}
@override
ClosedTabTombstone createAlias(String alias) {
return ClosedTabTombstone(attachedDatabase, alias);
}
@override
bool get dontWriteConstraints => true;
}
class ClosedTabTombstoneData extends DataClass
implements Insertable<ClosedTabTombstoneData> {
final String tabId;
final int closedAt;
const ClosedTabTombstoneData({required this.tabId, required this.closedAt});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['tab_id'] = Variable<String>(tabId);
map['closed_at'] = Variable<int>(closedAt);
return map;
}
factory ClosedTabTombstoneData.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return ClosedTabTombstoneData(
tabId: serializer.fromJson<String>(json['tabId']),
closedAt: serializer.fromJson<int>(json['closedAt']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'tabId': serializer.toJson<String>(tabId),
'closedAt': serializer.toJson<int>(closedAt),
};
}
ClosedTabTombstoneData copyWith({String? tabId, int? closedAt}) =>
ClosedTabTombstoneData(
tabId: tabId ?? this.tabId,
closedAt: closedAt ?? this.closedAt,
);
ClosedTabTombstoneData copyWithCompanion(ClosedTabTombstoneCompanion data) {
return ClosedTabTombstoneData(
tabId: data.tabId.present ? data.tabId.value : this.tabId,
closedAt: data.closedAt.present ? data.closedAt.value : this.closedAt,
);
}
@override
String toString() {
return (StringBuffer('ClosedTabTombstoneData(')
..write('tabId: $tabId, ')
..write('closedAt: $closedAt')
..write(')'))
.toString();
}
@override
int get hashCode => Object.hash(tabId, closedAt);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is ClosedTabTombstoneData &&
other.tabId == this.tabId &&
other.closedAt == this.closedAt);
}
class ClosedTabTombstoneCompanion
extends UpdateCompanion<ClosedTabTombstoneData> {
final Value<String> tabId;
final Value<int> closedAt;
final Value<int> rowid;
const ClosedTabTombstoneCompanion({
this.tabId = const Value.absent(),
this.closedAt = const Value.absent(),
this.rowid = const Value.absent(),
});
ClosedTabTombstoneCompanion.insert({
required String tabId,
required int closedAt,
this.rowid = const Value.absent(),
}) : tabId = Value(tabId),
closedAt = Value(closedAt);
static Insertable<ClosedTabTombstoneData> custom({
Expression<String>? tabId,
Expression<int>? closedAt,
Expression<int>? rowid,
}) {
return RawValuesInsertable({
if (tabId != null) 'tab_id': tabId,
if (closedAt != null) 'closed_at': closedAt,
if (rowid != null) 'rowid': rowid,
});
}
ClosedTabTombstoneCompanion copyWith({
Value<String>? tabId,
Value<int>? closedAt,
Value<int>? rowid,
}) {
return ClosedTabTombstoneCompanion(
tabId: tabId ?? this.tabId,
closedAt: closedAt ?? this.closedAt,
rowid: rowid ?? this.rowid,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (tabId.present) {
map['tab_id'] = Variable<String>(tabId.value);
}
if (closedAt.present) {
map['closed_at'] = Variable<int>(closedAt.value);
}
if (rowid.present) {
map['rowid'] = Variable<int>(rowid.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('ClosedTabTombstoneCompanion(')
..write('tabId: $tabId, ')
..write('closedAt: $closedAt, ')
..write('rowid: $rowid')
..write(')'))
.toString();
}
}
class CaptureTab extends Table with TableInfo<CaptureTab, CaptureTabData> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
CaptureTab(this.attachedDatabase, [this._alias]);
late final GeneratedColumn<String> tabId = GeneratedColumn<String>(
'tab_id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
$customConstraints:
'NOT NULL PRIMARY KEY REFERENCES tab(id)ON DELETE CASCADE',
);
late final GeneratedColumn<String> captureId = GeneratedColumn<String>(
'capture_id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
$customConstraints: 'NOT NULL',
);
late final GeneratedColumn<String> sourceUrl = GeneratedColumn<String>(
'source_url',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
$customConstraints: 'NOT NULL',
);
late final GeneratedColumn<String> status = GeneratedColumn<String>(
'status',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
$customConstraints: 'NOT NULL DEFAULT \'pending\'',
defaultValue: const CustomExpression('\'pending\''),
);
late final GeneratedColumn<int> createdAt = GeneratedColumn<int>(
'created_at',
aliasedName,
false,
type: DriftSqlType.int,
requiredDuringInsert: true,
$customConstraints: 'NOT NULL',
);
@override
List<GeneratedColumn> get $columns => [
tabId,
captureId,
sourceUrl,
status,
createdAt,
];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'capture_tab';
@override
Set<GeneratedColumn> get $primaryKey => {tabId};
@override
CaptureTabData map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return CaptureTabData(
tabId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}tab_id'],
)!,
captureId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}capture_id'],
)!,
sourceUrl: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}source_url'],
)!,
status: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}status'],
)!,
createdAt: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}created_at'],
)!,
);
}
@override
CaptureTab createAlias(String alias) {
return CaptureTab(attachedDatabase, alias);
}
@override
bool get dontWriteConstraints => true;
}
class CaptureTabData extends DataClass implements Insertable<CaptureTabData> {
final String tabId;
final String captureId;
final String sourceUrl;
final String status;
final int createdAt;
const CaptureTabData({
required this.tabId,
required this.captureId,
required this.sourceUrl,
required this.status,
required this.createdAt,
});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['tab_id'] = Variable<String>(tabId);
map['capture_id'] = Variable<String>(captureId);
map['source_url'] = Variable<String>(sourceUrl);
map['status'] = Variable<String>(status);
map['created_at'] = Variable<int>(createdAt);
return map;
}
factory CaptureTabData.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return CaptureTabData(
tabId: serializer.fromJson<String>(json['tabId']),
captureId: serializer.fromJson<String>(json['captureId']),
sourceUrl: serializer.fromJson<String>(json['sourceUrl']),
status: serializer.fromJson<String>(json['status']),
createdAt: serializer.fromJson<int>(json['createdAt']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'tabId': serializer.toJson<String>(tabId),
'captureId': serializer.toJson<String>(captureId),
'sourceUrl': serializer.toJson<String>(sourceUrl),
'status': serializer.toJson<String>(status),
'createdAt': serializer.toJson<int>(createdAt),
};
}
CaptureTabData copyWith({
String? tabId,
String? captureId,
String? sourceUrl,
String? status,
int? createdAt,
}) => CaptureTabData(
tabId: tabId ?? this.tabId,
captureId: captureId ?? this.captureId,
sourceUrl: sourceUrl ?? this.sourceUrl,
status: status ?? this.status,
createdAt: createdAt ?? this.createdAt,
);
CaptureTabData copyWithCompanion(CaptureTabCompanion data) {
return CaptureTabData(
tabId: data.tabId.present ? data.tabId.value : this.tabId,
captureId: data.captureId.present ? data.captureId.value : this.captureId,
sourceUrl: data.sourceUrl.present ? data.sourceUrl.value : this.sourceUrl,
status: data.status.present ? data.status.value : this.status,
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
);
}
@override
String toString() {
return (StringBuffer('CaptureTabData(')
..write('tabId: $tabId, ')
..write('captureId: $captureId, ')
..write('sourceUrl: $sourceUrl, ')
..write('status: $status, ')
..write('createdAt: $createdAt')
..write(')'))
.toString();
}
@override
int get hashCode =>
Object.hash(tabId, captureId, sourceUrl, status, createdAt);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is CaptureTabData &&
other.tabId == this.tabId &&
other.captureId == this.captureId &&
other.sourceUrl == this.sourceUrl &&
other.status == this.status &&
other.createdAt == this.createdAt);
}
class CaptureTabCompanion extends UpdateCompanion<CaptureTabData> {
final Value<String> tabId;
final Value<String> captureId;
final Value<String> sourceUrl;
final Value<String> status;
final Value<int> createdAt;
final Value<int> rowid;
const CaptureTabCompanion({
this.tabId = const Value.absent(),
this.captureId = const Value.absent(),
this.sourceUrl = const Value.absent(),
this.status = const Value.absent(),
this.createdAt = const Value.absent(),
this.rowid = const Value.absent(),
});
CaptureTabCompanion.insert({
required String tabId,
required String captureId,
required String sourceUrl,
this.status = const Value.absent(),
required int createdAt,
this.rowid = const Value.absent(),
}) : tabId = Value(tabId),
captureId = Value(captureId),
sourceUrl = Value(sourceUrl),
createdAt = Value(createdAt);
static Insertable<CaptureTabData> custom({
Expression<String>? tabId,
Expression<String>? captureId,
Expression<String>? sourceUrl,
Expression<String>? status,
Expression<int>? createdAt,
Expression<int>? rowid,
}) {
return RawValuesInsertable({
if (tabId != null) 'tab_id': tabId,
if (captureId != null) 'capture_id': captureId,
if (sourceUrl != null) 'source_url': sourceUrl,
if (status != null) 'status': status,
if (createdAt != null) 'created_at': createdAt,
if (rowid != null) 'rowid': rowid,
});
}
CaptureTabCompanion copyWith({
Value<String>? tabId,
Value<String>? captureId,
Value<String>? sourceUrl,
Value<String>? status,
Value<int>? createdAt,
Value<int>? rowid,
}) {
return CaptureTabCompanion(
tabId: tabId ?? this.tabId,
captureId: captureId ?? this.captureId,
sourceUrl: sourceUrl ?? this.sourceUrl,
status: status ?? this.status,
createdAt: createdAt ?? this.createdAt,
rowid: rowid ?? this.rowid,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (tabId.present) {
map['tab_id'] = Variable<String>(tabId.value);
}
if (captureId.present) {
map['capture_id'] = Variable<String>(captureId.value);
}
if (sourceUrl.present) {
map['source_url'] = Variable<String>(sourceUrl.value);
}
if (status.present) {
map['status'] = Variable<String>(status.value);
}
if (createdAt.present) {
map['created_at'] = Variable<int>(createdAt.value);
}
if (rowid.present) {
map['rowid'] = Variable<int>(rowid.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('CaptureTabCompanion(')
..write('tabId: $tabId, ')
..write('captureId: $captureId, ')
..write('sourceUrl: $sourceUrl, ')
..write('status: $status, ')
..write('createdAt: $createdAt, ')
..write('rowid: $rowid')
..write(')'))
.toString();
}
}
class TabFts extends Table
with TableInfo<TabFts, TabFtsData>, VirtualTableInfo<TabFts, TabFtsData> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
TabFts(this.attachedDatabase, [this._alias]);
late final GeneratedColumn<String> title = GeneratedColumn<String>(
'title',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
$customConstraints: '',
);
late final GeneratedColumn<String> url = GeneratedColumn<String>(
'url',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
$customConstraints: '',
);
late final GeneratedColumn<String> extractedContentPlain =
GeneratedColumn<String>(
'extracted_content_plain',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
$customConstraints: '',
);
late final GeneratedColumn<String> fullContentPlain = GeneratedColumn<String>(
'full_content_plain',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
$customConstraints: '',
);
@override
List<GeneratedColumn> get $columns => [
title,
url,
extractedContentPlain,
fullContentPlain,
];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'tab_fts';
@override
Set<GeneratedColumn> get $primaryKey => const {};
@override
TabFtsData map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return TabFtsData(
title: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}title'],
),
url: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}url'],
),
extractedContentPlain: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}extracted_content_plain'],
),
fullContentPlain: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}full_content_plain'],
),
);
}
@override
TabFts createAlias(String alias) {
return TabFts(attachedDatabase, alias);
}
@override
bool get dontWriteConstraints => true;
@override
String get moduleAndArgs =>
'fts5(title, url, extracted_content_plain, full_content_plain, content=tab, tokenize="trigram")';
}
class TabFtsData extends DataClass implements Insertable<TabFtsData> {
final String? title;
final String? url;
final String? extractedContentPlain;
final String? fullContentPlain;
const TabFtsData({
this.title,
this.url,
this.extractedContentPlain,
this.fullContentPlain,
});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (!nullToAbsent || title != null) {
map['title'] = Variable<String>(title);
}
if (!nullToAbsent || url != null) {
map['url'] = Variable<String>(url);
}
if (!nullToAbsent || extractedContentPlain != null) {
map['extracted_content_plain'] = Variable<String>(extractedContentPlain);
}
if (!nullToAbsent || fullContentPlain != null) {
map['full_content_plain'] = Variable<String>(fullContentPlain);
}
return map;
}
factory TabFtsData.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return TabFtsData(
title: serializer.fromJson<String?>(json['title']),
url: serializer.fromJson<String?>(json['url']),
extractedContentPlain: serializer.fromJson<String?>(
json['extractedContentPlain'],
),
fullContentPlain: serializer.fromJson<String?>(json['fullContentPlain']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'title': serializer.toJson<String?>(title),
'url': serializer.toJson<String?>(url),
'extractedContentPlain': serializer.toJson<String?>(
extractedContentPlain,
),
'fullContentPlain': serializer.toJson<String?>(fullContentPlain),
};
}
TabFtsData copyWith({
Value<String?> title = const Value.absent(),
Value<String?> url = const Value.absent(),
Value<String?> extractedContentPlain = const Value.absent(),
Value<String?> fullContentPlain = const Value.absent(),
}) => TabFtsData(
title: title.present ? title.value : this.title,
url: url.present ? url.value : this.url,
extractedContentPlain: extractedContentPlain.present
? extractedContentPlain.value
: this.extractedContentPlain,
fullContentPlain: fullContentPlain.present
? fullContentPlain.value
: this.fullContentPlain,
);
TabFtsData copyWithCompanion(TabFtsCompanion data) {
return TabFtsData(
title: data.title.present ? data.title.value : this.title,
url: data.url.present ? data.url.value : this.url,
extractedContentPlain: data.extractedContentPlain.present
? data.extractedContentPlain.value
: this.extractedContentPlain,
fullContentPlain: data.fullContentPlain.present
? data.fullContentPlain.value
: this.fullContentPlain,
);
}
@override
String toString() {
return (StringBuffer('TabFtsData(')
..write('title: $title, ')
..write('url: $url, ')
..write('extractedContentPlain: $extractedContentPlain, ')
..write('fullContentPlain: $fullContentPlain')
..write(')'))
.toString();
}
@override
int get hashCode =>
Object.hash(title, url, extractedContentPlain, fullContentPlain);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is TabFtsData &&
other.title == this.title &&
other.url == this.url &&
other.extractedContentPlain == this.extractedContentPlain &&
other.fullContentPlain == this.fullContentPlain);
}
class TabFtsCompanion extends UpdateCompanion<TabFtsData> {
final Value<String?> title;
final Value<String?> url;
final Value<String?> extractedContentPlain;
final Value<String?> fullContentPlain;
final Value<int> rowid;
const TabFtsCompanion({
this.title = const Value.absent(),
this.url = const Value.absent(),
this.extractedContentPlain = const Value.absent(),
this.fullContentPlain = const Value.absent(),
this.rowid = const Value.absent(),
});
TabFtsCompanion.insert({
this.title = const Value.absent(),
this.url = const Value.absent(),
this.extractedContentPlain = const Value.absent(),
this.fullContentPlain = const Value.absent(),
this.rowid = const Value.absent(),
});
static Insertable<TabFtsData> custom({
Expression<String>? title,
Expression<String>? url,
Expression<String>? extractedContentPlain,
Expression<String>? fullContentPlain,
Expression<int>? rowid,
}) {
return RawValuesInsertable({
if (title != null) 'title': title,
if (url != null) 'url': url,
if (extractedContentPlain != null)
'extracted_content_plain': extractedContentPlain,
if (fullContentPlain != null) 'full_content_plain': fullContentPlain,
if (rowid != null) 'rowid': rowid,
});
}
TabFtsCompanion copyWith({
Value<String?>? title,
Value<String?>? url,
Value<String?>? extractedContentPlain,
Value<String?>? fullContentPlain,
Value<int>? rowid,
}) {
return TabFtsCompanion(
title: title ?? this.title,
url: url ?? this.url,
extractedContentPlain:
extractedContentPlain ?? this.extractedContentPlain,
fullContentPlain: fullContentPlain ?? this.fullContentPlain,
rowid: rowid ?? this.rowid,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (title.present) {
map['title'] = Variable<String>(title.value);
}
if (url.present) {
map['url'] = Variable<String>(url.value);
}
if (extractedContentPlain.present) {
map['extracted_content_plain'] = Variable<String>(
extractedContentPlain.value,
);
}
if (fullContentPlain.present) {
map['full_content_plain'] = Variable<String>(fullContentPlain.value);
}
if (rowid.present) {
map['rowid'] = Variable<int>(rowid.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('TabFtsCompanion(')
..write('title: $title, ')
..write('url: $url, ')
..write('extractedContentPlain: $extractedContentPlain, ')
..write('fullContentPlain: $fullContentPlain, ')
..write('rowid: $rowid')
..write(')'))
.toString();
}
}
class LocalIndexSetting extends Table
with TableInfo<LocalIndexSetting, LocalIndexSettingData> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
LocalIndexSetting(this.attachedDatabase, [this._alias]);
late final GeneratedColumn<String> key = GeneratedColumn<String>(
'key',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
$customConstraints: 'PRIMARY KEY NOT NULL',
);
late final GeneratedColumn<int> value = GeneratedColumn<int>(
'value',
aliasedName,
false,
type: DriftSqlType.int,
requiredDuringInsert: true,
$customConstraints: 'NOT NULL',
);
@override
List<GeneratedColumn> get $columns => [key, value];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'local_index_setting';
@override
Set<GeneratedColumn> get $primaryKey => {key};
@override
LocalIndexSettingData map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return LocalIndexSettingData(
key: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}key'],
)!,
value: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}value'],
)!,
);
}
@override
LocalIndexSetting createAlias(String alias) {
return LocalIndexSetting(attachedDatabase, alias);
}
@override
bool get isStrict => true;
@override
bool get dontWriteConstraints => true;
}
class LocalIndexSettingData extends DataClass
implements Insertable<LocalIndexSettingData> {
final String key;
final int value;
const LocalIndexSettingData({required this.key, required this.value});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['key'] = Variable<String>(key);
map['value'] = Variable<int>(value);
return map;
}
factory LocalIndexSettingData.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return LocalIndexSettingData(
key: serializer.fromJson<String>(json['key']),
value: serializer.fromJson<int>(json['value']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'key': serializer.toJson<String>(key),
'value': serializer.toJson<int>(value),
};
}
LocalIndexSettingData copyWith({String? key, int? value}) =>
LocalIndexSettingData(key: key ?? this.key, value: value ?? this.value);
LocalIndexSettingData copyWithCompanion(LocalIndexSettingCompanion data) {
return LocalIndexSettingData(
key: data.key.present ? data.key.value : this.key,
value: data.value.present ? data.value.value : this.value,
);
}
@override
String toString() {
return (StringBuffer('LocalIndexSettingData(')
..write('key: $key, ')
..write('value: $value')
..write(')'))
.toString();
}
@override
int get hashCode => Object.hash(key, value);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is LocalIndexSettingData &&
other.key == this.key &&
other.value == this.value);
}
class LocalIndexSettingCompanion
extends UpdateCompanion<LocalIndexSettingData> {
final Value<String> key;
final Value<int> value;
final Value<int> rowid;
const LocalIndexSettingCompanion({
this.key = const Value.absent(),
this.value = const Value.absent(),
this.rowid = const Value.absent(),
});
LocalIndexSettingCompanion.insert({
required String key,
required int value,
this.rowid = const Value.absent(),
}) : key = Value(key),
value = Value(value);
static Insertable<LocalIndexSettingData> custom({
Expression<String>? key,
Expression<int>? value,
Expression<int>? rowid,
}) {
return RawValuesInsertable({
if (key != null) 'key': key,
if (value != null) 'value': value,
if (rowid != null) 'rowid': rowid,
});
}
LocalIndexSettingCompanion copyWith({
Value<String>? key,
Value<int>? value,
Value<int>? rowid,
}) {
return LocalIndexSettingCompanion(
key: key ?? this.key,
value: value ?? this.value,
rowid: rowid ?? this.rowid,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (key.present) {
map['key'] = Variable<String>(key.value);
}
if (value.present) {
map['value'] = Variable<int>(value.value);
}
if (rowid.present) {
map['rowid'] = Variable<int>(rowid.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('LocalIndexSettingCompanion(')
..write('key: $key, ')
..write('value: $value, ')
..write('rowid: $rowid')
..write(')'))
.toString();
}
}
class History extends Table with TableInfo<History, HistoryData> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
History(this.attachedDatabase, [this._alias]);
late final GeneratedColumn<String> urlCanonical = GeneratedColumn<String>(
'url_canonical',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
$customConstraints: 'PRIMARY KEY NOT NULL',
);
late final GeneratedColumn<String> urlHost = GeneratedColumn<String>(
'url_host',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
$customConstraints: 'NOT NULL',
);
late final GeneratedColumn<String> urlPath = GeneratedColumn<String>(
'url_path',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
$customConstraints: '',
);
late final GeneratedColumn<String> title = GeneratedColumn<String>(
'title',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
$customConstraints: '',
);
late final GeneratedColumn<int> isProbablyReaderable = GeneratedColumn<int>(
'is_probably_readerable',
aliasedName,
true,
type: DriftSqlType.int,
requiredDuringInsert: false,
$customConstraints: '',
);
late final GeneratedColumn<String> extractedContentMarkdown =
GeneratedColumn<String>(
'extracted_content_markdown',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
$customConstraints: '',
);
late final GeneratedColumn<String> extractedContentPlain =
GeneratedColumn<String>(
'extracted_content_plain',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
$customConstraints: '',
);
late final GeneratedColumn<String> fullContentMarkdown =
GeneratedColumn<String>(
'full_content_markdown',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
$customConstraints: '',
);
late final GeneratedColumn<String> fullContentPlain = GeneratedColumn<String>(
'full_content_plain',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
$customConstraints: '',
);
late final GeneratedColumn<int> contentHash = GeneratedColumn<int>(
'content_hash',
aliasedName,
true,
type: DriftSqlType.int,
requiredDuringInsert: false,
$customConstraints: '',
);
late final GeneratedColumn<int> observedAt = GeneratedColumn<int>(
'observed_at',
aliasedName,
false,
type: DriftSqlType.int,
requiredDuringInsert: true,
$customConstraints: 'NOT NULL',
);
late final GeneratedColumn<int> observedCount = GeneratedColumn<int>(
'observed_count',
aliasedName,
false,
type: DriftSqlType.int,
requiredDuringInsert: false,
$customConstraints: 'NOT NULL DEFAULT 1',
defaultValue: const CustomExpression('1'),
);
@override
List<GeneratedColumn> get $columns => [
urlCanonical,
urlHost,
urlPath,
title,
isProbablyReaderable,
extractedContentMarkdown,
extractedContentPlain,
fullContentMarkdown,
fullContentPlain,
contentHash,
observedAt,
observedCount,
];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'history';
@override
Set<GeneratedColumn> get $primaryKey => {urlCanonical};
@override
HistoryData map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return HistoryData(
urlCanonical: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}url_canonical'],
)!,
urlHost: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}url_host'],
)!,
urlPath: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}url_path'],
),
title: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}title'],
),
isProbablyReaderable: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}is_probably_readerable'],
),
extractedContentMarkdown: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}extracted_content_markdown'],
),
extractedContentPlain: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}extracted_content_plain'],
),
fullContentMarkdown: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}full_content_markdown'],
),
fullContentPlain: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}full_content_plain'],
),
contentHash: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}content_hash'],
),
observedAt: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}observed_at'],
)!,
observedCount: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}observed_count'],
)!,
);
}
@override
History createAlias(String alias) {
return History(attachedDatabase, alias);
}
@override
bool get dontWriteConstraints => true;
}
class HistoryData extends DataClass implements Insertable<HistoryData> {
final String urlCanonical;
final String urlHost;
final String? urlPath;
final String? title;
final int? isProbablyReaderable;
final String? extractedContentMarkdown;
final String? extractedContentPlain;
final String? fullContentMarkdown;
final String? fullContentPlain;
final int? contentHash;
final int observedAt;
final int observedCount;
const HistoryData({
required this.urlCanonical,
required this.urlHost,
this.urlPath,
this.title,
this.isProbablyReaderable,
this.extractedContentMarkdown,
this.extractedContentPlain,
this.fullContentMarkdown,
this.fullContentPlain,
this.contentHash,
required this.observedAt,
required this.observedCount,
});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['url_canonical'] = Variable<String>(urlCanonical);
map['url_host'] = Variable<String>(urlHost);
if (!nullToAbsent || urlPath != null) {
map['url_path'] = Variable<String>(urlPath);
}
if (!nullToAbsent || title != null) {
map['title'] = Variable<String>(title);
}
if (!nullToAbsent || isProbablyReaderable != null) {
map['is_probably_readerable'] = Variable<int>(isProbablyReaderable);
}
if (!nullToAbsent || extractedContentMarkdown != null) {
map['extracted_content_markdown'] = Variable<String>(
extractedContentMarkdown,
);
}
if (!nullToAbsent || extractedContentPlain != null) {
map['extracted_content_plain'] = Variable<String>(extractedContentPlain);
}
if (!nullToAbsent || fullContentMarkdown != null) {
map['full_content_markdown'] = Variable<String>(fullContentMarkdown);
}
if (!nullToAbsent || fullContentPlain != null) {
map['full_content_plain'] = Variable<String>(fullContentPlain);
}
if (!nullToAbsent || contentHash != null) {
map['content_hash'] = Variable<int>(contentHash);
}
map['observed_at'] = Variable<int>(observedAt);
map['observed_count'] = Variable<int>(observedCount);
return map;
}
factory HistoryData.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return HistoryData(
urlCanonical: serializer.fromJson<String>(json['urlCanonical']),
urlHost: serializer.fromJson<String>(json['urlHost']),
urlPath: serializer.fromJson<String?>(json['urlPath']),
title: serializer.fromJson<String?>(json['title']),
isProbablyReaderable: serializer.fromJson<int?>(
json['isProbablyReaderable'],
),
extractedContentMarkdown: serializer.fromJson<String?>(
json['extractedContentMarkdown'],
),
extractedContentPlain: serializer.fromJson<String?>(
json['extractedContentPlain'],
),
fullContentMarkdown: serializer.fromJson<String?>(
json['fullContentMarkdown'],
),
fullContentPlain: serializer.fromJson<String?>(json['fullContentPlain']),
contentHash: serializer.fromJson<int?>(json['contentHash']),
observedAt: serializer.fromJson<int>(json['observedAt']),
observedCount: serializer.fromJson<int>(json['observedCount']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'urlCanonical': serializer.toJson<String>(urlCanonical),
'urlHost': serializer.toJson<String>(urlHost),
'urlPath': serializer.toJson<String?>(urlPath),
'title': serializer.toJson<String?>(title),
'isProbablyReaderable': serializer.toJson<int?>(isProbablyReaderable),
'extractedContentMarkdown': serializer.toJson<String?>(
extractedContentMarkdown,
),
'extractedContentPlain': serializer.toJson<String?>(
extractedContentPlain,
),
'fullContentMarkdown': serializer.toJson<String?>(fullContentMarkdown),
'fullContentPlain': serializer.toJson<String?>(fullContentPlain),
'contentHash': serializer.toJson<int?>(contentHash),
'observedAt': serializer.toJson<int>(observedAt),
'observedCount': serializer.toJson<int>(observedCount),
};
}
HistoryData copyWith({
String? urlCanonical,
String? urlHost,
Value<String?> urlPath = const Value.absent(),
Value<String?> title = const Value.absent(),
Value<int?> isProbablyReaderable = const Value.absent(),
Value<String?> extractedContentMarkdown = const Value.absent(),
Value<String?> extractedContentPlain = const Value.absent(),
Value<String?> fullContentMarkdown = const Value.absent(),
Value<String?> fullContentPlain = const Value.absent(),
Value<int?> contentHash = const Value.absent(),
int? observedAt,
int? observedCount,
}) => HistoryData(
urlCanonical: urlCanonical ?? this.urlCanonical,
urlHost: urlHost ?? this.urlHost,
urlPath: urlPath.present ? urlPath.value : this.urlPath,
title: title.present ? title.value : this.title,
isProbablyReaderable: isProbablyReaderable.present
? isProbablyReaderable.value
: this.isProbablyReaderable,
extractedContentMarkdown: extractedContentMarkdown.present
? extractedContentMarkdown.value
: this.extractedContentMarkdown,
extractedContentPlain: extractedContentPlain.present
? extractedContentPlain.value
: this.extractedContentPlain,
fullContentMarkdown: fullContentMarkdown.present
? fullContentMarkdown.value
: this.fullContentMarkdown,
fullContentPlain: fullContentPlain.present
? fullContentPlain.value
: this.fullContentPlain,
contentHash: contentHash.present ? contentHash.value : this.contentHash,
observedAt: observedAt ?? this.observedAt,
observedCount: observedCount ?? this.observedCount,
);
HistoryData copyWithCompanion(HistoryCompanion data) {
return HistoryData(
urlCanonical: data.urlCanonical.present
? data.urlCanonical.value
: this.urlCanonical,
urlHost: data.urlHost.present ? data.urlHost.value : this.urlHost,
urlPath: data.urlPath.present ? data.urlPath.value : this.urlPath,
title: data.title.present ? data.title.value : this.title,
isProbablyReaderable: data.isProbablyReaderable.present
? data.isProbablyReaderable.value
: this.isProbablyReaderable,
extractedContentMarkdown: data.extractedContentMarkdown.present
? data.extractedContentMarkdown.value
: this.extractedContentMarkdown,
extractedContentPlain: data.extractedContentPlain.present
? data.extractedContentPlain.value
: this.extractedContentPlain,
fullContentMarkdown: data.fullContentMarkdown.present
? data.fullContentMarkdown.value
: this.fullContentMarkdown,
fullContentPlain: data.fullContentPlain.present
? data.fullContentPlain.value
: this.fullContentPlain,
contentHash: data.contentHash.present
? data.contentHash.value
: this.contentHash,
observedAt: data.observedAt.present
? data.observedAt.value
: this.observedAt,
observedCount: data.observedCount.present
? data.observedCount.value
: this.observedCount,
);
}
@override
String toString() {
return (StringBuffer('HistoryData(')
..write('urlCanonical: $urlCanonical, ')
..write('urlHost: $urlHost, ')
..write('urlPath: $urlPath, ')
..write('title: $title, ')
..write('isProbablyReaderable: $isProbablyReaderable, ')
..write('extractedContentMarkdown: $extractedContentMarkdown, ')
..write('extractedContentPlain: $extractedContentPlain, ')
..write('fullContentMarkdown: $fullContentMarkdown, ')
..write('fullContentPlain: $fullContentPlain, ')
..write('contentHash: $contentHash, ')
..write('observedAt: $observedAt, ')
..write('observedCount: $observedCount')
..write(')'))
.toString();
}
@override
int get hashCode => Object.hash(
urlCanonical,
urlHost,
urlPath,
title,
isProbablyReaderable,
extractedContentMarkdown,
extractedContentPlain,
fullContentMarkdown,
fullContentPlain,
contentHash,
observedAt,
observedCount,
);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is HistoryData &&
other.urlCanonical == this.urlCanonical &&
other.urlHost == this.urlHost &&
other.urlPath == this.urlPath &&
other.title == this.title &&
other.isProbablyReaderable == this.isProbablyReaderable &&
other.extractedContentMarkdown == this.extractedContentMarkdown &&
other.extractedContentPlain == this.extractedContentPlain &&
other.fullContentMarkdown == this.fullContentMarkdown &&
other.fullContentPlain == this.fullContentPlain &&
other.contentHash == this.contentHash &&
other.observedAt == this.observedAt &&
other.observedCount == this.observedCount);
}
class HistoryCompanion extends UpdateCompanion<HistoryData> {
final Value<String> urlCanonical;
final Value<String> urlHost;
final Value<String?> urlPath;
final Value<String?> title;
final Value<int?> isProbablyReaderable;
final Value<String?> extractedContentMarkdown;
final Value<String?> extractedContentPlain;
final Value<String?> fullContentMarkdown;
final Value<String?> fullContentPlain;
final Value<int?> contentHash;
final Value<int> observedAt;
final Value<int> observedCount;
final Value<int> rowid;
const HistoryCompanion({
this.urlCanonical = const Value.absent(),
this.urlHost = const Value.absent(),
this.urlPath = const Value.absent(),
this.title = const Value.absent(),
this.isProbablyReaderable = const Value.absent(),
this.extractedContentMarkdown = const Value.absent(),
this.extractedContentPlain = const Value.absent(),
this.fullContentMarkdown = const Value.absent(),
this.fullContentPlain = const Value.absent(),
this.contentHash = const Value.absent(),
this.observedAt = const Value.absent(),
this.observedCount = const Value.absent(),
this.rowid = const Value.absent(),
});
HistoryCompanion.insert({
required String urlCanonical,
required String urlHost,
this.urlPath = const Value.absent(),
this.title = const Value.absent(),
this.isProbablyReaderable = const Value.absent(),
this.extractedContentMarkdown = const Value.absent(),
this.extractedContentPlain = const Value.absent(),
this.fullContentMarkdown = const Value.absent(),
this.fullContentPlain = const Value.absent(),
this.contentHash = const Value.absent(),
required int observedAt,
this.observedCount = const Value.absent(),
this.rowid = const Value.absent(),
}) : urlCanonical = Value(urlCanonical),
urlHost = Value(urlHost),
observedAt = Value(observedAt);
static Insertable<HistoryData> custom({
Expression<String>? urlCanonical,
Expression<String>? urlHost,
Expression<String>? urlPath,
Expression<String>? title,
Expression<int>? isProbablyReaderable,
Expression<String>? extractedContentMarkdown,
Expression<String>? extractedContentPlain,
Expression<String>? fullContentMarkdown,
Expression<String>? fullContentPlain,
Expression<int>? contentHash,
Expression<int>? observedAt,
Expression<int>? observedCount,
Expression<int>? rowid,
}) {
return RawValuesInsertable({
if (urlCanonical != null) 'url_canonical': urlCanonical,
if (urlHost != null) 'url_host': urlHost,
if (urlPath != null) 'url_path': urlPath,
if (title != null) 'title': title,
if (isProbablyReaderable != null)
'is_probably_readerable': isProbablyReaderable,
if (extractedContentMarkdown != null)
'extracted_content_markdown': extractedContentMarkdown,
if (extractedContentPlain != null)
'extracted_content_plain': extractedContentPlain,
if (fullContentMarkdown != null)
'full_content_markdown': fullContentMarkdown,
if (fullContentPlain != null) 'full_content_plain': fullContentPlain,
if (contentHash != null) 'content_hash': contentHash,
if (observedAt != null) 'observed_at': observedAt,
if (observedCount != null) 'observed_count': observedCount,
if (rowid != null) 'rowid': rowid,
});
}
HistoryCompanion copyWith({
Value<String>? urlCanonical,
Value<String>? urlHost,
Value<String?>? urlPath,
Value<String?>? title,
Value<int?>? isProbablyReaderable,
Value<String?>? extractedContentMarkdown,
Value<String?>? extractedContentPlain,
Value<String?>? fullContentMarkdown,
Value<String?>? fullContentPlain,
Value<int?>? contentHash,
Value<int>? observedAt,
Value<int>? observedCount,
Value<int>? rowid,
}) {
return HistoryCompanion(
urlCanonical: urlCanonical ?? this.urlCanonical,
urlHost: urlHost ?? this.urlHost,
urlPath: urlPath ?? this.urlPath,
title: title ?? this.title,
isProbablyReaderable: isProbablyReaderable ?? this.isProbablyReaderable,
extractedContentMarkdown:
extractedContentMarkdown ?? this.extractedContentMarkdown,
extractedContentPlain:
extractedContentPlain ?? this.extractedContentPlain,
fullContentMarkdown: fullContentMarkdown ?? this.fullContentMarkdown,
fullContentPlain: fullContentPlain ?? this.fullContentPlain,
contentHash: contentHash ?? this.contentHash,
observedAt: observedAt ?? this.observedAt,
observedCount: observedCount ?? this.observedCount,
rowid: rowid ?? this.rowid,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (urlCanonical.present) {
map['url_canonical'] = Variable<String>(urlCanonical.value);
}
if (urlHost.present) {
map['url_host'] = Variable<String>(urlHost.value);
}
if (urlPath.present) {
map['url_path'] = Variable<String>(urlPath.value);
}
if (title.present) {
map['title'] = Variable<String>(title.value);
}
if (isProbablyReaderable.present) {
map['is_probably_readerable'] = Variable<int>(isProbablyReaderable.value);
}
if (extractedContentMarkdown.present) {
map['extracted_content_markdown'] = Variable<String>(
extractedContentMarkdown.value,
);
}
if (extractedContentPlain.present) {
map['extracted_content_plain'] = Variable<String>(
extractedContentPlain.value,
);
}
if (fullContentMarkdown.present) {
map['full_content_markdown'] = Variable<String>(
fullContentMarkdown.value,
);
}
if (fullContentPlain.present) {
map['full_content_plain'] = Variable<String>(fullContentPlain.value);
}
if (contentHash.present) {
map['content_hash'] = Variable<int>(contentHash.value);
}
if (observedAt.present) {
map['observed_at'] = Variable<int>(observedAt.value);
}
if (observedCount.present) {
map['observed_count'] = Variable<int>(observedCount.value);
}
if (rowid.present) {
map['rowid'] = Variable<int>(rowid.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('HistoryCompanion(')
..write('urlCanonical: $urlCanonical, ')
..write('urlHost: $urlHost, ')
..write('urlPath: $urlPath, ')
..write('title: $title, ')
..write('isProbablyReaderable: $isProbablyReaderable, ')
..write('extractedContentMarkdown: $extractedContentMarkdown, ')
..write('extractedContentPlain: $extractedContentPlain, ')
..write('fullContentMarkdown: $fullContentMarkdown, ')
..write('fullContentPlain: $fullContentPlain, ')
..write('contentHash: $contentHash, ')
..write('observedAt: $observedAt, ')
..write('observedCount: $observedCount, ')
..write('rowid: $rowid')
..write(')'))
.toString();
}
}
class HistoryFts extends Table
with
TableInfo<HistoryFts, HistoryFtsData>,
VirtualTableInfo<HistoryFts, HistoryFtsData> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
HistoryFts(this.attachedDatabase, [this._alias]);
late final GeneratedColumn<String> title = GeneratedColumn<String>(
'title',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
$customConstraints: '',
);
late final GeneratedColumn<String> urlHost = GeneratedColumn<String>(
'url_host',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
$customConstraints: '',
);
late final GeneratedColumn<String> urlPath = GeneratedColumn<String>(
'url_path',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
$customConstraints: '',
);
late final GeneratedColumn<String> extractedContentPlain =
GeneratedColumn<String>(
'extracted_content_plain',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
$customConstraints: '',
);
late final GeneratedColumn<String> fullContentPlain = GeneratedColumn<String>(
'full_content_plain',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
$customConstraints: '',
);
@override
List<GeneratedColumn> get $columns => [
title,
urlHost,
urlPath,
extractedContentPlain,
fullContentPlain,
];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'history_fts';
@override
Set<GeneratedColumn> get $primaryKey => const {};
@override
HistoryFtsData map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return HistoryFtsData(
title: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}title'],
),
urlHost: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}url_host'],
),
urlPath: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}url_path'],
),
extractedContentPlain: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}extracted_content_plain'],
),
fullContentPlain: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}full_content_plain'],
),
);
}
@override
HistoryFts createAlias(String alias) {
return HistoryFts(attachedDatabase, alias);
}
@override
bool get dontWriteConstraints => true;
@override
String get moduleAndArgs =>
'fts5(title, url_host, url_path, extracted_content_plain, full_content_plain, content=history, tokenize="trigram")';
}
class HistoryFtsData extends DataClass implements Insertable<HistoryFtsData> {
final String? title;
final String? urlHost;
final String? urlPath;
final String? extractedContentPlain;
final String? fullContentPlain;
const HistoryFtsData({
this.title,
this.urlHost,
this.urlPath,
this.extractedContentPlain,
this.fullContentPlain,
});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (!nullToAbsent || title != null) {
map['title'] = Variable<String>(title);
}
if (!nullToAbsent || urlHost != null) {
map['url_host'] = Variable<String>(urlHost);
}
if (!nullToAbsent || urlPath != null) {
map['url_path'] = Variable<String>(urlPath);
}
if (!nullToAbsent || extractedContentPlain != null) {
map['extracted_content_plain'] = Variable<String>(extractedContentPlain);
}
if (!nullToAbsent || fullContentPlain != null) {
map['full_content_plain'] = Variable<String>(fullContentPlain);
}
return map;
}
factory HistoryFtsData.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return HistoryFtsData(
title: serializer.fromJson<String?>(json['title']),
urlHost: serializer.fromJson<String?>(json['urlHost']),
urlPath: serializer.fromJson<String?>(json['urlPath']),
extractedContentPlain: serializer.fromJson<String?>(
json['extractedContentPlain'],
),
fullContentPlain: serializer.fromJson<String?>(json['fullContentPlain']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'title': serializer.toJson<String?>(title),
'urlHost': serializer.toJson<String?>(urlHost),
'urlPath': serializer.toJson<String?>(urlPath),
'extractedContentPlain': serializer.toJson<String?>(
extractedContentPlain,
),
'fullContentPlain': serializer.toJson<String?>(fullContentPlain),
};
}
HistoryFtsData copyWith({
Value<String?> title = const Value.absent(),
Value<String?> urlHost = const Value.absent(),
Value<String?> urlPath = const Value.absent(),
Value<String?> extractedContentPlain = const Value.absent(),
Value<String?> fullContentPlain = const Value.absent(),
}) => HistoryFtsData(
title: title.present ? title.value : this.title,
urlHost: urlHost.present ? urlHost.value : this.urlHost,
urlPath: urlPath.present ? urlPath.value : this.urlPath,
extractedContentPlain: extractedContentPlain.present
? extractedContentPlain.value
: this.extractedContentPlain,
fullContentPlain: fullContentPlain.present
? fullContentPlain.value
: this.fullContentPlain,
);
HistoryFtsData copyWithCompanion(HistoryFtsCompanion data) {
return HistoryFtsData(
title: data.title.present ? data.title.value : this.title,
urlHost: data.urlHost.present ? data.urlHost.value : this.urlHost,
urlPath: data.urlPath.present ? data.urlPath.value : this.urlPath,
extractedContentPlain: data.extractedContentPlain.present
? data.extractedContentPlain.value
: this.extractedContentPlain,
fullContentPlain: data.fullContentPlain.present
? data.fullContentPlain.value
: this.fullContentPlain,
);
}
@override
String toString() {
return (StringBuffer('HistoryFtsData(')
..write('title: $title, ')
..write('urlHost: $urlHost, ')
..write('urlPath: $urlPath, ')
..write('extractedContentPlain: $extractedContentPlain, ')
..write('fullContentPlain: $fullContentPlain')
..write(')'))
.toString();
}
@override
int get hashCode => Object.hash(
title,
urlHost,
urlPath,
extractedContentPlain,
fullContentPlain,
);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is HistoryFtsData &&
other.title == this.title &&
other.urlHost == this.urlHost &&
other.urlPath == this.urlPath &&
other.extractedContentPlain == this.extractedContentPlain &&
other.fullContentPlain == this.fullContentPlain);
}
class HistoryFtsCompanion extends UpdateCompanion<HistoryFtsData> {
final Value<String?> title;
final Value<String?> urlHost;
final Value<String?> urlPath;
final Value<String?> extractedContentPlain;
final Value<String?> fullContentPlain;
final Value<int> rowid;
const HistoryFtsCompanion({
this.title = const Value.absent(),
this.urlHost = const Value.absent(),
this.urlPath = const Value.absent(),
this.extractedContentPlain = const Value.absent(),
this.fullContentPlain = const Value.absent(),
this.rowid = const Value.absent(),
});
HistoryFtsCompanion.insert({
this.title = const Value.absent(),
this.urlHost = const Value.absent(),
this.urlPath = const Value.absent(),
this.extractedContentPlain = const Value.absent(),
this.fullContentPlain = const Value.absent(),
this.rowid = const Value.absent(),
});
static Insertable<HistoryFtsData> custom({
Expression<String>? title,
Expression<String>? urlHost,
Expression<String>? urlPath,
Expression<String>? extractedContentPlain,
Expression<String>? fullContentPlain,
Expression<int>? rowid,
}) {
return RawValuesInsertable({
if (title != null) 'title': title,
if (urlHost != null) 'url_host': urlHost,
if (urlPath != null) 'url_path': urlPath,
if (extractedContentPlain != null)
'extracted_content_plain': extractedContentPlain,
if (fullContentPlain != null) 'full_content_plain': fullContentPlain,
if (rowid != null) 'rowid': rowid,
});
}
HistoryFtsCompanion copyWith({
Value<String?>? title,
Value<String?>? urlHost,
Value<String?>? urlPath,
Value<String?>? extractedContentPlain,
Value<String?>? fullContentPlain,
Value<int>? rowid,
}) {
return HistoryFtsCompanion(
title: title ?? this.title,
urlHost: urlHost ?? this.urlHost,
urlPath: urlPath ?? this.urlPath,
extractedContentPlain:
extractedContentPlain ?? this.extractedContentPlain,
fullContentPlain: fullContentPlain ?? this.fullContentPlain,
rowid: rowid ?? this.rowid,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (title.present) {
map['title'] = Variable<String>(title.value);
}
if (urlHost.present) {
map['url_host'] = Variable<String>(urlHost.value);
}
if (urlPath.present) {
map['url_path'] = Variable<String>(urlPath.value);
}
if (extractedContentPlain.present) {
map['extracted_content_plain'] = Variable<String>(
extractedContentPlain.value,
);
}
if (fullContentPlain.present) {
map['full_content_plain'] = Variable<String>(fullContentPlain.value);
}
if (rowid.present) {
map['rowid'] = Variable<int>(rowid.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('HistoryFtsCompanion(')
..write('title: $title, ')
..write('urlHost: $urlHost, ')
..write('urlPath: $urlPath, ')
..write('extractedContentPlain: $extractedContentPlain, ')
..write('fullContentPlain: $fullContentPlain, ')
..write('rowid: $rowid')
..write(')'))
.toString();
}
}
class DatabaseAtV14 extends GeneratedDatabase {
DatabaseAtV14(QueryExecutor e) : super(e);
late final Container container = Container(this);
late final Tab tab = Tab(this);
late final ClosedTabTombstone closedTabTombstone = ClosedTabTombstone(this);
late final Index idxTabParentContainer = Index(
'idx_tab_parent_container',
'CREATE INDEX idx_tab_parent_container ON tab (parent_id, container_id)',
);
late final CaptureTab captureTab = CaptureTab(this);
late final Index idxCaptureTabCaptureId = Index(
'idx_capture_tab_capture_id',
'CREATE INDEX idx_capture_tab_capture_id ON capture_tab (capture_id)',
);
late final TabFts tabFts = TabFts(this);
late final Trigger tabMaintainParentChainOnDelete = Trigger(
'CREATE TRIGGER tab_maintain_parent_chain_on_delete BEFORE DELETE ON tab BEGIN UPDATE tab SET parent_id = CASE WHEN OLD.parent_id IS NOT NULL AND EXISTS (SELECT 1 FROM tab WHERE id = OLD.parent_id) THEN OLD.parent_id ELSE NULL END WHERE parent_id = OLD.id;END',
'tab_maintain_parent_chain_on_delete',
);
late final Trigger tabAfterInsert = Trigger(
'CREATE TRIGGER tab_after_insert AFTER INSERT ON tab BEGIN INSERT INTO tab_fts ("rowid", title, url, extracted_content_plain, full_content_plain) VALUES (new."rowid", new.title, new.url, new.extracted_content_plain, new.full_content_plain);END',
'tab_after_insert',
);
late final Trigger tabAfterDelete = Trigger(
'CREATE TRIGGER tab_after_delete AFTER DELETE ON tab BEGIN INSERT INTO tab_fts (tab_fts, "rowid", title, url, extracted_content_plain, full_content_plain) VALUES (\'delete\', old."rowid", old.title, old.url, old.extracted_content_plain, old.full_content_plain);END',
'tab_after_delete',
);
late final Trigger tabAfterUpdate = Trigger(
'CREATE TRIGGER tab_after_update AFTER UPDATE OF title, url, extracted_content_plain, full_content_plain ON tab WHEN OLD.content_hash IS NOT NEW.content_hash OR OLD.url IS NOT NEW.url BEGIN INSERT INTO tab_fts (tab_fts, "rowid", title, url, extracted_content_plain, full_content_plain) VALUES (\'delete\', old."rowid", old.title, old.url, old.extracted_content_plain, old.full_content_plain);INSERT INTO tab_fts ("rowid", title, url, extracted_content_plain, full_content_plain) VALUES (new."rowid", new.title, new.url, new.extracted_content_plain, new.full_content_plain);END',
'tab_after_update',
);
late final LocalIndexSetting localIndexSetting = LocalIndexSetting(this);
late final History history = History(this);
late final Index idxHistoryHost = Index(
'idx_history_host',
'CREATE INDEX idx_history_host ON history (url_host)',
);
late final Index idxHistoryObserved = Index(
'idx_history_observed',
'CREATE INDEX idx_history_observed ON history (observed_at DESC)',
);
late final HistoryFts historyFts = HistoryFts(this);
late final Trigger historyAfterInsert = Trigger(
'CREATE TRIGGER history_after_insert AFTER INSERT ON history BEGIN INSERT INTO history_fts ("rowid", title, url_host, url_path, extracted_content_plain, full_content_plain) VALUES (new."rowid", new.title, new.url_host, new.url_path, new.extracted_content_plain, new.full_content_plain);END',
'history_after_insert',
);
late final Trigger historyAfterDelete = Trigger(
'CREATE TRIGGER history_after_delete AFTER DELETE ON history BEGIN INSERT INTO history_fts (history_fts, "rowid", title, url_host, url_path, extracted_content_plain, full_content_plain) VALUES (\'delete\', old."rowid", old.title, old.url_host, old.url_path, old.extracted_content_plain, old.full_content_plain);END',
'history_after_delete',
);
late final Trigger historyAfterUpdate = Trigger(
'CREATE TRIGGER history_after_update AFTER UPDATE OF title, url_host, url_path, extracted_content_plain, full_content_plain ON history BEGIN INSERT INTO history_fts (history_fts, "rowid", title, url_host, url_path, extracted_content_plain, full_content_plain) VALUES (\'delete\', old."rowid", old.title, old.url_host, old.url_path, old.extracted_content_plain, old.full_content_plain);INSERT INTO history_fts ("rowid", title, url_host, url_path, extracted_content_plain, full_content_plain) VALUES (new."rowid", new.title, new.url_host, new.url_path, new.extracted_content_plain, new.full_content_plain);END',
'history_after_update',
);
late final Trigger tabToHistoryOnInsert = Trigger(
'CREATE TRIGGER tab_to_history_on_insert AFTER INSERT ON tab WHEN NEW.url IS NOT NULL AND url_indexable(CAST(NEW.url AS TEXT)) = 1 AND (SELECT value FROM local_index_setting WHERE "key" = \'enabled\') = 1 AND(NEW.tab_mode != 1 OR (SELECT value FROM local_index_setting WHERE "key" = \'index_private\') = 1)AND NOT EXISTS (SELECT 1 FROM container WHERE container.id = NEW.container_id AND json_extract(container.metadata, \'\$.excludeFromIndex\') = 1) BEGIN INSERT INTO history (url_canonical, url_host, url_path, title, is_probably_readerable, extracted_content_markdown, extracted_content_plain, full_content_markdown, full_content_plain, content_hash, observed_at, observed_count) VALUES (url_canonical(CAST(NEW.url AS TEXT)), url_host(CAST(NEW.url AS TEXT)), url_path(CAST(NEW.url AS TEXT)), NEW.title, NEW.is_probably_readerable, NEW.extracted_content_markdown, NEW.extracted_content_plain, NEW.full_content_markdown, NEW.full_content_plain, NEW.content_hash, strftime(\'%s\', \'now\') * 1000, 1) ON CONFLICT (url_canonical) DO UPDATE SET title = COALESCE(excluded.title, history.title), is_probably_readerable = excluded.is_probably_readerable, extracted_content_markdown = excluded.extracted_content_markdown, extracted_content_plain = excluded.extracted_content_plain, full_content_markdown = excluded.full_content_markdown, full_content_plain = excluded.full_content_plain, content_hash = excluded.content_hash, observed_at = excluded.observed_at, observed_count = history.observed_count + 1 WHERE history.content_hash IS NOT excluded.content_hash;END',
'tab_to_history_on_insert',
);
late final Trigger tabToHistoryOnUpdate = Trigger(
'CREATE TRIGGER tab_to_history_on_update AFTER UPDATE OF title, url, extracted_content_plain, extracted_content_markdown, full_content_plain, full_content_markdown, is_probably_readerable ON tab WHEN NEW.url IS NOT NULL AND url_indexable(CAST(NEW.url AS TEXT)) = 1 AND(OLD.content_hash IS NOT NEW.content_hash OR OLD.url IS NOT NEW.url)AND (SELECT value FROM local_index_setting WHERE "key" = \'enabled\') = 1 AND(NEW.tab_mode != 1 OR (SELECT value FROM local_index_setting WHERE "key" = \'index_private\') = 1)AND NOT EXISTS (SELECT 1 FROM container WHERE container.id = NEW.container_id AND json_extract(container.metadata, \'\$.excludeFromIndex\') = 1) BEGIN INSERT INTO history (url_canonical, url_host, url_path, title, is_probably_readerable, extracted_content_markdown, extracted_content_plain, full_content_markdown, full_content_plain, content_hash, observed_at, observed_count) VALUES (url_canonical(CAST(NEW.url AS TEXT)), url_host(CAST(NEW.url AS TEXT)), url_path(CAST(NEW.url AS TEXT)), NEW.title, NEW.is_probably_readerable, NEW.extracted_content_markdown, NEW.extracted_content_plain, NEW.full_content_markdown, NEW.full_content_plain, NEW.content_hash, strftime(\'%s\', \'now\') * 1000, 1) ON CONFLICT (url_canonical) DO UPDATE SET title = COALESCE(excluded.title, history.title), is_probably_readerable = excluded.is_probably_readerable, extracted_content_markdown = excluded.extracted_content_markdown, extracted_content_plain = excluded.extracted_content_plain, full_content_markdown = excluded.full_content_markdown, full_content_plain = excluded.full_content_plain, content_hash = excluded.content_hash, observed_at = excluded.observed_at, observed_count = history.observed_count + 1 WHERE history.content_hash IS NOT excluded.content_hash;END',
'tab_to_history_on_update',
);
late final Trigger tabToHistoryOnContainerUpdate = Trigger(
'CREATE TRIGGER tab_to_history_on_container_update AFTER UPDATE OF container_id ON tab WHEN NEW.url IS NOT NULL AND url_indexable(CAST(NEW.url AS TEXT)) = 1 AND (SELECT value FROM local_index_setting WHERE "key" = \'enabled\') = 1 BEGIN DELETE FROM history WHERE url_canonical = url_canonical(CAST(NEW.url AS TEXT)) AND NOT EXISTS (SELECT 1 FROM tab AS candidate WHERE candidate.url IS NOT NULL AND url_indexable(CAST(candidate.url AS TEXT)) = 1 AND url_canonical(CAST(candidate.url AS TEXT)) = history.url_canonical AND(candidate.tab_mode != 1 OR (SELECT value FROM local_index_setting WHERE "key" = \'index_private\') = 1)AND NOT EXISTS (SELECT 1 FROM container WHERE container.id = candidate.container_id AND json_extract(container.metadata, \'\$.excludeFromIndex\') = 1));INSERT INTO history (url_canonical, url_host, url_path, title, is_probably_readerable, extracted_content_markdown, extracted_content_plain, full_content_markdown, full_content_plain, content_hash, observed_at, observed_count) SELECT url_canonical(CAST(candidate.url AS TEXT)), url_host(CAST(candidate.url AS TEXT)), url_path(CAST(candidate.url AS TEXT)), candidate.title, candidate.is_probably_readerable, candidate.extracted_content_markdown, candidate.extracted_content_plain, candidate.full_content_markdown, candidate.full_content_plain, candidate.content_hash, strftime(\'%s\', \'now\') * 1000, 1 FROM tab AS candidate WHERE candidate.url IS NOT NULL AND url_indexable(CAST(candidate.url AS TEXT)) = 1 AND url_canonical(CAST(candidate.url AS TEXT)) = url_canonical(CAST(NEW.url AS TEXT)) AND(candidate.tab_mode != 1 OR (SELECT value FROM local_index_setting WHERE "key" = \'index_private\') = 1)AND NOT EXISTS (SELECT 1 FROM container WHERE container.id = candidate.container_id AND json_extract(container.metadata, \'\$.excludeFromIndex\') = 1) ORDER BY candidate.timestamp DESC, candidate."rowid" DESC LIMIT 1 ON CONFLICT (url_canonical) DO UPDATE SET title = COALESCE(excluded.title, history.title), is_probably_readerable = excluded.is_probably_readerable, extracted_content_markdown = excluded.extracted_content_markdown, extracted_content_plain = excluded.extracted_content_plain, full_content_markdown = excluded.full_content_markdown, full_content_plain = excluded.full_content_plain, content_hash = excluded.content_hash, observed_at = excluded.observed_at, observed_count = history.observed_count + 1;END',
'tab_to_history_on_container_update',
);
late final Trigger containerToHistoryOnMetadataUpdate = Trigger(
'CREATE TRIGGER container_to_history_on_metadata_update AFTER UPDATE OF metadata ON container WHEN COALESCE(json_extract(OLD.metadata, \'\$.excludeFromIndex\') = 1, 0) != COALESCE(json_extract(NEW.metadata, \'\$.excludeFromIndex\') = 1, 0) AND (SELECT value FROM local_index_setting WHERE "key" = \'enabled\') = 1 BEGIN DELETE FROM history WHERE url_canonical IN (SELECT DISTINCT url_canonical(CAST(affected.url AS TEXT)) FROM tab AS affected WHERE affected.container_id = NEW.id AND affected.url IS NOT NULL AND url_indexable(CAST(affected.url AS TEXT)) = 1) AND NOT EXISTS (SELECT 1 FROM tab AS candidate WHERE candidate.url IS NOT NULL AND url_indexable(CAST(candidate.url AS TEXT)) = 1 AND url_canonical(CAST(candidate.url AS TEXT)) = history.url_canonical AND(candidate.tab_mode != 1 OR (SELECT value FROM local_index_setting WHERE "key" = \'index_private\') = 1)AND NOT EXISTS (SELECT 1 FROM container WHERE container.id = candidate.container_id AND json_extract(container.metadata, \'\$.excludeFromIndex\') = 1));INSERT INTO history (url_canonical, url_host, url_path, title, is_probably_readerable, extracted_content_markdown, extracted_content_plain, full_content_markdown, full_content_plain, content_hash, observed_at, observed_count) SELECT url_canonical(CAST(candidate.url AS TEXT)), url_host(CAST(candidate.url AS TEXT)), url_path(CAST(candidate.url AS TEXT)), candidate.title, candidate.is_probably_readerable, candidate.extracted_content_markdown, candidate.extracted_content_plain, candidate.full_content_markdown, candidate.full_content_plain, candidate.content_hash, strftime(\'%s\', \'now\') * 1000, 1 FROM tab AS candidate WHERE candidate.url IS NOT NULL AND url_indexable(CAST(candidate.url AS TEXT)) = 1 AND url_canonical(CAST(candidate.url AS TEXT)) IN (SELECT DISTINCT url_canonical(CAST(affected.url AS TEXT)) FROM tab AS affected WHERE affected.container_id = NEW.id AND affected.url IS NOT NULL AND url_indexable(CAST(affected.url AS TEXT)) = 1) AND(candidate.tab_mode != 1 OR (SELECT value FROM local_index_setting WHERE "key" = \'index_private\') = 1)AND NOT EXISTS (SELECT 1 FROM container WHERE container.id = candidate.container_id AND json_extract(container.metadata, \'\$.excludeFromIndex\') = 1) AND NOT EXISTS (SELECT 1 FROM tab AS newer WHERE newer.url IS NOT NULL AND url_indexable(CAST(newer.url AS TEXT)) = 1 AND url_canonical(CAST(newer.url AS TEXT)) = url_canonical(CAST(candidate.url AS TEXT)) AND(newer.tab_mode != 1 OR (SELECT value FROM local_index_setting WHERE "key" = \'index_private\') = 1)AND NOT EXISTS (SELECT 1 FROM container WHERE container.id = newer.container_id AND json_extract(container.metadata, \'\$.excludeFromIndex\') = 1) AND(newer.timestamp > candidate.timestamp OR(newer.timestamp = candidate.timestamp AND newer."rowid" > candidate."rowid"))) ON CONFLICT (url_canonical) DO UPDATE SET title = COALESCE(excluded.title, history.title), is_probably_readerable = excluded.is_probably_readerable, extracted_content_markdown = excluded.extracted_content_markdown, extracted_content_plain = excluded.extracted_content_plain, full_content_markdown = excluded.full_content_markdown, full_content_plain = excluded.full_content_plain, content_hash = excluded.content_hash, observed_at = excluded.observed_at, observed_count = history.observed_count + 1;END',
'container_to_history_on_metadata_update',
);
@override
Iterable<TableInfo<Table, Object?>> get allTables =>
allSchemaEntities.whereType<TableInfo<Table, Object?>>();
@override
List<DatabaseSchemaEntity> get allSchemaEntities => [
container,
tab,
closedTabTombstone,
idxTabParentContainer,
captureTab,
idxCaptureTabCaptureId,
tabFts,
tabMaintainParentChainOnDelete,
tabAfterInsert,
tabAfterDelete,
tabAfterUpdate,
localIndexSetting,
history,
idxHistoryHost,
idxHistoryObserved,
historyFts,
historyAfterInsert,
historyAfterDelete,
historyAfterUpdate,
tabToHistoryOnInsert,
tabToHistoryOnUpdate,
tabToHistoryOnContainerUpdate,
containerToHistoryOnMetadataUpdate,
];
@override
StreamQueryUpdateRules get streamUpdateRules => const StreamQueryUpdateRules([
WritePropagation(
on: TableUpdateQuery.onTableName(
'container',
limitUpdateKind: UpdateKind.delete,
),
result: [TableUpdate('tab', kind: UpdateKind.delete)],
),
WritePropagation(
on: TableUpdateQuery.onTableName(
'tab',
limitUpdateKind: UpdateKind.delete,
),
result: [TableUpdate('capture_tab', kind: UpdateKind.delete)],
),
WritePropagation(
on: TableUpdateQuery.onTableName(
'tab',
limitUpdateKind: UpdateKind.delete,
),
result: [TableUpdate('tab', kind: UpdateKind.update)],
),
WritePropagation(
on: TableUpdateQuery.onTableName(
'tab',
limitUpdateKind: UpdateKind.insert,
),
result: [TableUpdate('tab_fts', kind: UpdateKind.insert)],
),
WritePropagation(
on: TableUpdateQuery.onTableName(
'tab',
limitUpdateKind: UpdateKind.delete,
),
result: [TableUpdate('tab_fts', kind: UpdateKind.insert)],
),
WritePropagation(
on: TableUpdateQuery.onTableName(
'tab',
limitUpdateKind: UpdateKind.update,
),
result: [TableUpdate('tab_fts', kind: UpdateKind.insert)],
),
WritePropagation(
on: TableUpdateQuery.onTableName(
'history',
limitUpdateKind: UpdateKind.insert,
),
result: [TableUpdate('history_fts', kind: UpdateKind.insert)],
),
WritePropagation(
on: TableUpdateQuery.onTableName(
'history',
limitUpdateKind: UpdateKind.delete,
),
result: [TableUpdate('history_fts', kind: UpdateKind.insert)],
),
WritePropagation(
on: TableUpdateQuery.onTableName(
'history',
limitUpdateKind: UpdateKind.update,
),
result: [TableUpdate('history_fts', kind: UpdateKind.insert)],
),
WritePropagation(
on: TableUpdateQuery.onTableName(
'tab',
limitUpdateKind: UpdateKind.insert,
),
result: [TableUpdate('history', kind: UpdateKind.insert)],
),
WritePropagation(
on: TableUpdateQuery.onTableName(
'tab',
limitUpdateKind: UpdateKind.update,
),
result: [TableUpdate('history', kind: UpdateKind.insert)],
),
WritePropagation(
on: TableUpdateQuery.onTableName(
'tab',
limitUpdateKind: UpdateKind.update,
),
result: [
TableUpdate('history', kind: UpdateKind.delete),
TableUpdate('history', kind: UpdateKind.insert),
],
),
WritePropagation(
on: TableUpdateQuery.onTableName(
'container',
limitUpdateKind: UpdateKind.update,
),
result: [
TableUpdate('history', kind: UpdateKind.delete),
TableUpdate('history', kind: UpdateKind.insert),
],
),
]);
@override
int get schemaVersion => 14;
}